4 ms·
Uhm, I'm pretty sure this page is wrong, and the compiler cannot optimize this out. An "indeterminate" value is either an unspecified value or a trap representa
by wfunction 9y ago
Uhm, I'm pretty sure this page is wrong, and the compiler cannot optimize this out. An "indeterminate" value is either an unspecified value or a trap representation. Like they said, the value here cannot be a trap representation, so it's just an unspecified value. An unspecified value is merely an unknown value, NOT a dynamically-mutating value, and NOT a trap representation. So XORing an unspecified value with itself must result in zero, not undefined behavior. (UB would occur with a trap representation, which this isn't.)
- szemet 9y agoHere the first answer says (with some quotations) that it depends on, if the variable could be declared as register or not. https://stackoverflow.com/questions/11962457/why-is-using-an-uninitialized-variable-undefined-behavior https://stackoverflow.com/questions/11962457/why-is-using-an... edit: i recognised that it does not count as the original example is about an array element...