Tail pad optimization, cache friendlyness and C++ interrop

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 10 23:11:27 PDT 2014


On Wednesday, 11 June 2014 at 04:11:53 UTC, Walter Bright wrote:
> Hmm, this could have serious problems with the following:
>
> S1 s1;
> S2 s2;
> s2.c = 3;
> memcpy(&s2.s1, &s1, sizeof(S1)); // Oops! stomped on s2.c

Yes, that is why they do it only in specific condition (ie when 
the thing use C++ specific feature and not C one). This kind of 
thing is valid in C, but isn't supposed to be in C++, and 
certainly not in @safe D.


More information about the Digitalmars-d mailing list