auto storage class - infer or RAII?

Lionello Lunesu lio at lunesu.remove.com
Mon Nov 13 23:26:52 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
> }

Confusing.. I thought const in D meant really 'constant'. If a const in 
a function can have different values across calls, then I suppose a 
const for a class can have different value for different instances too?

L.



More information about the Digitalmars-d mailing list