Casting away const and invariant

Janice Caron caron800 at googlemail.com
Sun Sep 9 14:27:59 PDT 2007


> Just to be clear: I assume the behavior of casting away const and then
> reading the ex-const variable is defined, otherwise it doesn't make much
> sense. The only thing undefined is writing a const casted variable.

Yes. It's undefined for all sort of reasons ... either because it
might not be /possible/ to write it (because it might be in ROM); or
because changing might violate thread-safety; etc.. But you can always
read it, whether it's const or not.



More information about the Digitalmars-d mailing list