On Thursday, 9 August 2012 at 17:25:48 UTC, egslava wrote:
If I will change "immutable" to "const" output will not changed.
But why? Why output is look like this?

Just to repeat the gist of it: immutable is a guarantee that the value stored in the variable will never change, and the compiler is free to assume that when optimizing code. By using a cast and then writing to the location, you have subverted the type system, so all bets are off – in fact, your program is experiencing undefined behavior.

David

Reply via email to