I want to do something like this:
union U {
int i;
double d;
};
void foo (double *d) { *d = 3.4; }
int main ()
{
union U u;
foo (&(u.d));
}
gcc
does not complain (with -Wall -Wextra
) and it works as expected, but I would like to make sure it is actually legal (according to the standard).