Casting away const

Steven Schveighoffer schveiguy at yahoo.com
Mon Aug 9 05:32:37 PDT 2010


On Sun, 08 Aug 2010 17:56:25 -0400, simendsjo <simen.endsjo at pandavre.com>  
wrote:

> I'm totally new to the const/immutable thing, so this might be a naive  
> question..
>
> The spec says:
> "modification after casting away const" => "undefined behavior"

I thought it was "you're on your own", not undefined behavior.  The former  
implies there is some "right" way to do this if you know more about the  
data than the compiler, the latter implies that there is no right way to  
cast away const.  Am I wrong?

-Steve


More information about the Digitalmars-d-learn mailing list