3 ms·
Type-punning through unions is already legal in C99, but there's a known error in Annex J, listing it incorrectly as unspecified behaviour. See http://stackove
by cygx 15y ago
Type-punning through unions is already legal in C99, but there's a known error in Annex J, listing it incorrectly as unspecified behaviour.
See http://stackoverflow.com/a/8513748/48015 http://stackoverflow.com/a/8513748/48015
- legooolas 15y agoI stand corrected :/
- cygx 15y agoDon't feel bad about it - the C standard can be quite subtle, and I've been known to spread lies about it as well. Things about which I have stumbled somewhat recently: * restrict-qualified pointer-to-const parameters do not guarantee that the pointed-to object won't be modified as restrict only applies if the pointer is actually used to access the object, which calling code can't know (ie restrict only enables optimizations in the called code and not reordering in calling code) * functions with differently qualified, but otherwise compatible parameter types have compatible type (which is only mentioned in the last, parenthesized sentence of section 6.7.5.3)