Steven Schveighoffer: > 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?
In my opinion if this thing is well designed then you go in undefined behaviour only when you change the contents of something after you have removed its const nature with a cast. Just casting const away and then reading the data can't be undefined behaviour, otherwise casting const away is useless and can be totally disallowed. Bye, bearophile