Is this legal in C?
struct Doubles
{
double a,b,c;
};
void foo(struct Doubles* bar)
{
double* baz = (double*)bar;
baz[0]++;
baz[1]++;
baz[2]++;
}
I know that it "works" on MSVC 2010, but I donβt know if this is legal, or if different layouts can cause UB.
source
share