▲ | amboar a day ago | |
Section J.1 _Unspecified_ behavior says > (11) The values of bytes that correspond to union members other than the one last stored into (6.2.6.1). So it's a little more constrained in the ramifications, but the outcomes may still be surprising. It's a bit unfortunate that "UB" aliases to both "Undefined behavior" and "Unspecified behavior" given they have subtly different definitions. From section 4 we have: > A program that is correct in all other aspects, operating on correct data, containing unspecified behavior shall be a correct program and act in accordance with 5.1.2.4. |