
12 Oct
2007
12 Oct
'07
6:41 a.m.
Sebastian Redl wrote:
Absolutely not. The only circumstance in which you may access a member of a union that is not the one that has been most recently set is when you access common, structurally conformant members of structs, i.e.
Hmm, you may have missed the details of my example, so I repeat the essentials: struct foo1 { unsigned data[4]; }; struct foo2 { unsigned data[2]; }; struct bar { foo1 a; foo2 b; }; union { data[6]; bar b; }; Are those types not "layout compatible" as the standard requires for the access I intend? I mean foo1, foo2 are POD. So the question boils down to whether foo1 and unsigned data[4] are layout compatible, not? Roland aka speedsnail