2 ms·
This is not valid C usage of unions. They are _only_ for use as a method to save space, not for conversion between types That's incorrect. The following footno
by cygx 15y ago
This is not valid C usage of unions. They are _only_ for use as a method to save space, not for conversion between types
That's incorrect. The following footnote was added to section 6.5.2.3 with TC3 in 2007 to clear up this particular misconception:
"If the member used to access the contents of a union object is not the same as the member last used to store a value in the object, the appropriate part of the object representation of the value is reinterpreted as an object representation in the new type as described in 6.2.6 (a process sometimes called "type punning"). This might be a trap representation."