Auto syntax revisited

james james_member at pathlink.com
Wed Feb 22 07:05:52 PST 2006


In article <43FC743C.9090601 at nospam.org>, Georg Wrede says...
>
>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.)
Correct.


>> 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++)
It seems that the debate on auto has to do with how much explicit control the
programmer has over object creation/destruction and memory management.
Programmers who like auto are probably less keen on gc. And maybe would prefer
it as optional rather than by default. Though technically auto and gc are not
related.





More information about the Digitalmars-d mailing list