auto storage class - infer or RAII?

Tomas Lindquist Olsen tomas at famolsen.dk
Mon Nov 13 13:08:29 PST 2006


Sean Kelly wrote:
> Tomas Lindquist Olsen wrote:
>> Another argument for using 'auto' for ATI can be making it consistent 
>> with how it currently works for classes in DMD:
>>
>> class A
>> {
>>     static
>>     {
>>         auto x = 2;
>>         auto y = 42;
>>     }
>>     auto z = 27;
>> }
>>
>> This works. x and y are static!
> 
> I think this works everywhere, as you're free to chain storage classes 
> to your heart's delight:
> 
>     // what is this??
>     auto const static const static auto x = 5;
> 
> 
> Sean

That does not work:
scopetest.d(29): redundant storage class 'const'
scopetest.d(29): redundant storage class 'static'
scopetest.d(29): redundant storage class 'auto'



More information about the Digitalmars-d mailing list