Auto syntax revisited

Georg Wrede georg.wrede at nospam.org
Wed Feb 22 06:25:00 PST 2006


james wrote:
> Could auto also be used in class definitions as well as stack finalisaton of
> objects e.g
> 
> class X {
> 
> // the object is destroyed automatically when the class X is destroyed.
> auto A a = new A();
> }

(You mean _instance_ above, right? Classes don't get destroyed.)

> Personally i would like the above use of auto and make gc explicit ie:
> gc A a = new A();

GC has nothing to do with this.

If a programmer wants an object destroyed immediately after going out of 
scope (by whatever mechanism it may eventually happen), then this 
applies to GC collected programs as well as non-GC-collected. (e.g. C++)



More information about the Digitalmars-d mailing list