auto storage class - infer or RAII?

Bruno Medeiros brunodomedeiros+spam at com.gmail
Tue Nov 14 05:20:13 PST 2006


Walter Bright wrote:
> Tomas Lindquist Olsen wrote:
>> Can you post an example of why we need 'static const' ?
> 
> int foo(int x)
> {
>     static const i = x;    // error, x is not const
>     const j = x;    // ok, j is const for duration of foo() call
> }

I get "main.d(4): non-constant expression x", with such code:

   int foo(int x)
   {
     //static const i = x;
     const j = x;  // non-constant expression x
     return 1;
   }


-- 
Bruno Medeiros - MSc in CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D



More information about the Digitalmars-d mailing list