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

Mehrdad wfunction at hotmail.com
Thu Aug 16 19:09:06 PDT 2012


On Friday, 17 August 2012 at 02:02:56 UTC, Jonathan M Davis wrote:
> How is it a bug? The variable that you're altering is not part 
> of the object.


It doesn't need to be.


What you said was:



> If you have a const object, then you have the guarantee that 
> none of what it contains or refers to ____either directly or 
> indirectly_____ can be altered through that reference or 
> pointer.


But as I just showed, it can, so... yeah.



> That's part of why having pure with const in so valuable.

Right, but purity is another topic. :)


More information about the Digitalmars-d mailing list