if(;){} opinion

Lionello Lunesu lio at remove.lunesu.com
Tue Feb 28 00:09:17 PST 2006


"Walter Bright" <newshound at digitalmars.com> wrote in message 
news:du0sll$lj0$1 at digitaldaemon.com...
>
> "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." Types can be inferred with other storage classes:
>
>    static x = 3;        // x is int
>
> This follows the 'auto' proposal for C++ as far as I know.

Do you mean the two seemingly different "auto"s are not ambigious?

> 'var' would be a digression into pascalishness (ugh <g>).

I'm just glad you didn't use this argument against array slicing ; )

L. 





More information about the Digitalmars-d mailing list