2 ms·
No, this breaks aliasing. The defined way to do something like this is to have the smaller struct as the first member of the larger one. The first member is gu
by leni536 4y ago
No, this breaks aliasing.
The defined way to do something like this is to have the smaller struct as the first member of the larger one. The first member is guaranteed to have the same address as the outer object.
The common initial sequence trick is guaranteed to work with unions in limited circumstances.