Почему? С одной стороны int, int, int, с другой — int, int, int
It's undefined behavior to read from the member of the union that wasn't most recently written. Many compilers implement, as a non-standard language extension, the ability to read inactive members of a union.
It's undefined behavior to read from the member of the union that wasn't most recently written. Many compilers implement, as a non-standard language extension, the ability to read inactive members of a union.
А это разве об этом? Я имел в виду вот такую примерно структуру данных:
union { struct { int a; int b; int c; }; int i[3]; };
It's undefined behavior to read from the member of the union that wasn't most recently written. Many compilers implement, as a non-standard language extension, the ability to read inactive members of a union.
А это касется прям всех типов? А то в C это, вроде как, было валидной конструкцией.