On 4/19/14, Lars T. Kyllingstad via Digitalmars-d-learn
<digitalmars-d-learn@puremagic.com> wrote:
> Say I have two structs, defined like this:
>
>      struct A { /* could contain whatever */ }
>
>      struct B { A a; }
>
> My question is, is it now guaranteed that A.sizeof==B.sizeof?

The best thing to do is add a static assert and then you can relax:

-----
struct A { }
struct B { A a; }
static assert(A.sizeof == B.sizeof);
-----

As for the ABI, I don't think I've ever seen it mentioned anywhere.
  • Struct size Lars T. Kyllingstad via Digitalmars-d-learn
    • Re: Struct size Andrej Mitrovic via Digitalmars-d-learn
    • Re: Struct size Lars T. Kyllingstad via Digitalmars-d-learn

Reply via email to