I need to verify that I can use unions a certain way.
For C99, this answer is adequate: Union element alignment
C99 – section 6.7.2.1 Structure and
union specifiers (paragraph 14):A pointer to a union object, suitably
converted, points to each of its
members (or if a member is a bitfield,
then to the unit in which it resides),
and vice versa.
Can someone please help me find the equivalent guarantee for C++?
More generally, is there a good source for finding section/paragraph citations for C++ standards which are equivalent to a known feature in C?
Thanks a lot.
In C++ (14882:2003), this is split between two paragraphs:
9.5[class.union]/1
9.2[class.mem]/17
I haven’t heard of a cross-reference between C and C++ like that, it may be non-trivial, as this example shows.