Tail pad optimization, cache friendlyness and C++ interrop

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 10 20:19:55 PDT 2014


On 6/10/2014 7:44 PM, deadalnix wrote:
> 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).

Do any C++ compilers do this for this case, or just for the inheritance one?


More information about the Digitalmars-d mailing list