J
j0mbolar
The following was labeled as invoking undefined behavior
but I don't see that happening at all:
struct ints {
int a;
int b;
};
union merge {
float f;
struct ints typ;
};
union merge i;
union merge j;
i.f = 1;
j = i; /* means j.f = 1 ? */
i.typ.a = i.typ.b = 0; /* we assign here, we are not reading the value
of i.type.b */
j = i; /* means j.typ.a = j.typ.b = 0 ? */
This is all valid, right?
but I don't see that happening at all:
struct ints {
int a;
int b;
};
union merge {
float f;
struct ints typ;
};
union merge i;
union merge j;
i.f = 1;
j = i; /* means j.f = 1 ? */
i.typ.a = i.typ.b = 0; /* we assign here, we are not reading the value
of i.type.b */
j = i; /* means j.typ.a = j.typ.b = 0 ? */
This is all valid, right?