Tail pad optimization, cache friendlyness and C++ interrop

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 10 19:44:00 PDT 2014


On Wednesday, 11 June 2014 at 02:10:18 UTC, Walter Bright wrote:
> On 6/10/2014 5:27 PM, deadalnix wrote:
>> I'm talking about structs, not classes.
>
> Ok, but since D structs do not inherit, how does tail pad 
> optimization apply?

struct S1 {
      int a;
      byte b;
}

struct S2 {
      S1 s1;
      char c;
}

Sé could be 8 byte long (some variation of this are in C++ for
instance if I make a public and b private).


More information about the Digitalmars-d mailing list