Transitive const sucks

Walter Bright newshound1 at digitalmars.com
Thu Sep 13 00:57:51 PDT 2007


James Dennett wrote:
> Walter Bright wrote:
>> Or you can cast away const-ness. But you are on your own if you do that.
> 
> Well, in C++ you'd be fine, but in D I thought the behavior
> if you modified something after casting away const was
> undefined, so you're out of luck.  (Not that you'd need
> to cast away const for this in C++.)

It's also undefined behavior if you cast a pointer to an int. You need 
to know what you're doing.



More information about the Digitalmars-d mailing list