Add := digraph to D

Andrea Fontana nospam at example.com
Thu Jun 21 01:21:18 PDT 2012


I think he is speaking about "auto" keyword in c++.
In c++ auto mean that. (local lifetime)

On Thursday, 21 June 2012 at 08:12:58 UTC, Jonathan M Davis wrote:
> On Thursday, June 21, 2012 08:04:35 Christophe Travert wrote:
>> "Lars T. Kyllingstad" , dans le message 
>> (digitalmars.D:170370), a
>> 
>> >>> auto name = initializer;
>> >>> const name = initializer;
>> >>> immutable name = initializer;
>> >>> shared name = initializer;
>> >>> enum name = initializer;
>> >> 
>> >> After the first aren't these all just short hand for "const
>> >> auto name = init" etc with the given keyword?
>> > 
>> > No. Many don't realise this, but "auto" doesn't  actually 
>> > stand
>> > for "automatic type inference". It is a storage class, like
>> > static, extern, etc., and it means that the variable stops
>> > existing at the end of the scope. It is, however, the default
>> > storage class, which is why it is useful when all you want is
>> > type inference. Even C has auto.
>> 
>> auto is called a storage class, but where did you read that 
>> auto would
>> make the variable stop existing at the end of the scope ?
>
> Yeah. I'm pretty darn sure that he's wrong on that. All auto is 
> type
> inference. auto has no effect on the lifetime of a variable. 
> _All_ variables
> cease to exist when they exit scope. And reference and pointer 
> types continue
> to exist on the heap (it's just that the pointer or reference 
> is gone) without
> being destroyed or freed or whatnot. So, I don't know where 
> Lars got the idea
> that auto was anything other than type inference. Sure, it 
> might be termed a
> storage class, but that term seems to be pretty much 
> meaningless in D.
>
> - Jonathan M Davis




More information about the Digitalmars-d mailing list