What guarantees does D 'const' provide, compared to C++?

Mehrdad wfunction at hotmail.com
Thu Aug 16 17:34:27 PDT 2012


On Friday, 17 August 2012 at 00:32:03 UTC, Mehrdad wrote:
> Not correct, as far as I understand.
> C++ only lets you cast away _const references_ to _mutable_ 
> objects.
> If the object happens to have been const _itself_, then that's 
> undefined behavior.


Er, minor correction:

By "casting away const"  I mean  "casting away const and actually 
mutating the object through the new, unconst reference". 
Obviously, I'm not referring to the mere cast itself, which 
doesn't do anything unless used for something else.


More information about the Digitalmars-d mailing list