On 7/18/2016 9:08 AM, Andrew Godfrey wrote:
On Thursday, 14 July 2016 at 20:01:54 UTC, Walter Bright wrote:
On 7/14/2016 11:49 AM, Steven Schveighoffer wrote:
In C++, the compiler has to reload x, because it may have changed.
That's right. I learned that the hard way, when the original optimizer would
assume that x hadn't changed. It broke a surprising amount of code.
It also means that the utility of const in C++ is extremely limited.
Walter, I hope you were just in a rush. Because I think you meant to say, "the
utility of const in C++ for *optimizing code* is extremely limited".
No. I meant const's utility to provide checkable, reliable information about
code. I'm a big believer in encapsulation, and const is a major tool for that.
But C++ const just isn't very helpful.