Re:Initialization in C++ is Seriously Bonkers
by int_19h on Saturday January 05, 2019 @09:57PM
(#18836244)
Why would the code for "const int i" be any different from the code for "int i"? The Standard doesn't require the variable to be allocated in an immutable memory area. It just says that if you do anything to change its value, the result is undefined behavior. And actually changing the value in a way that would be observable via the const variable is a valid subset of undefined behavior.
[ Parent
| on HN ]
There are no comments on this comment yet.