On Tuesday, October 25, 2011 19:33:01 Gor Gyolchanyan wrote: > Nobody answered my question: > Why isn't const guaranteed to be placed in mutable storage? > It won't take advantages of immutable anyway, so why isn't it taking > advantages of potential logical const?
Logical const is not supported by the language. Casting away const and modifying a variable is undefined. As such, the language is free to treat a const and immutable value type on the stack identically. There is no real difference. True, there's a decent chance that the compiler will generate slightly different code depending on what the code's doing, but it doesn't have to. Modifying the variable is undefined in either case. The language is _not_ going to do anything to try and support the modifying of a const variable. - Jonathan M Davis
