Is this code well-defined?
int main()
{
union
{
int i;
float f;
} u;
u.f = 5.0;
u.i = u.f; // ?????
}
It accesses two different union members in one expression so I am wondering if it falls foul of the [class.union]/1 provisions about active member of a union.
The C++ Standard seems to underspecify which operations change the active member for builtin types, and what happens if an inactive member is read or written.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire