const vs immutable for local variables
spam at here.lot
Sat Nov 20 10:47:27 PST 2010
Jonathan M Davis Wrote:
> > Doesn't immutability imply static storage? I also thought, it's a way to
> > force CTFE.
> No. If it did, you couldn't initialize immutable stuff at runtime. Apparently, in
> the case of globals or member variables (which have to be initialized statically
> anyway), it does mean that they could be optimized out (e.g. there's an open bug
> report on the fact that immutable fields in structs don't take any space), but
> that's no the case for local variables which can be initialized at runtime.
I see no difference. Both globals and locals can be initialized at runtime and both can be static.
More information about the Digitalmars-d-learn