Casting away const
div0
div0 at sourceforge.net
Sun Aug 8 15:57:32 PDT 2010
On 08/08/2010 22:56, simendsjo 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"
Casting away const is mostly for dealing with external non D libraries.
Some languages have no notion of const, so you'll cast const away when
calling functions written in other languages.
Also a lot of old c & c++ code is none const correct so again you have
to discard const to interface with that code.
--
My enormous talent is exceeded only by my outrageous laziness.
http://www.ssTk.co.uk
More information about the Digitalmars-d-learn
mailing list