if(;){} opinion

Sean Kelly sean at f4.ca
Tue Feb 28 10:33:10 PST 2006


Walter Bright wrote:
> "Charles" <noone at nowhere.com> wrote in message 
> news:du002j$2pcm$1 at digitaldaemon.com...
>> I think its short for 'auto' deduction ?
>>
>> 'var' gets my vote
> 
> 'auto' goes way back to C and means "allocate on the stack". This also 
> implicitly means "destruct at end of scope." In order for type inference to 
> work, there has to be a keyword in front of the declaration to let the 
> parser know it's a declaration rather than an assignment. Thus, 'auto' now 
> means "allocate on the stack" and if the type is missing it also means 
> "infer the type."

Hold on.  Certainly you aren't suggesting that "auto myClass = new 
MyClass()" constructs an object that will be destroyed on scope exit? 
And if so, how do I auto-type objects without the RAII functionality?


Sean



More information about the Digitalmars-d mailing list