Casting away const

bearophile bearophileHUGS at lycos.com
Sun Aug 8 15:03:42 PDT 2010


simendsjo:
> But why would you want to cast away const then?

I presume for a situation where you are sure your code is just reading the information and not modifying it, and you need something that is not const.


> 	assert(i == 10); // i still 10 though.. How is this possible?

You have done something that you are not supposed to do. Undefined behaviour means that it generally produces unexpected effects/results :-)

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list