|
Answer» import std.stdio; STRUCT Foo { UNION { INT a; int b; } struct { int c; int d; } } void MAIN() { writefln( "Foo.sizeof = %d, a.offset = %d, b.offset = %d, c.offset = %d, d.offset = %d", Foo.sizeof, Foo.a.offsetof, Foo.b.offsetof, Foo.c.offsetof, Foo.d.offsetof); } import std.stdio; struct Foo { union { int a; int b; } struct { int c; int d; } } void main() { writefln( "Foo.sizeof = %d, a.offset = %d, b.offset = %d, c.offset = %d, d.offset = %d", Foo.sizeof, Foo.a.offsetof, Foo.b.offsetof, Foo.c.offsetof, Foo.d.offsetof); }
|