Yet yet yet yet another thread about const and immutable.
gor.f.gyolchanyan at gmail.com
Tue Oct 25 05:28:22 PDT 2011
I'm thinking, whether const is guaranteed _NOT_ to be put into read-only memory.
If so, then const can be safely used for "logical const" purposes.
I'd really like that, because then, const would be safe to cast away.
Since const does not contribute to anything else (in contrast to
immutable), it doesn't break anything to cast away const, except logic
(in some cases).
The most obvious case is to cast away const-ness of members of a class
from inside that class.
On Tue, Oct 25, 2011 at 4:23 PM, Jude Young <10equals2 at gmail.com> wrote:
> I'm sure that there is much more, but I immutable is set to global storage
> and not Thread Local Storage.
> I believe that const is stil TLS.
> On Tue, Oct 25, 2011 at 5:15 AM, Gor Gyolchanyan
> <gor.f.gyolchanyan at gmail.com> wrote:
>> What's the difference between const-declared variable and
>> immutable-declared variable?
>> module a;
>> const(int) a;
>> immutable(int) b;
>> void main()
More information about the Digitalmars-d