void initialization vs alignment holes

strtr strtr at spam.com
Sat Mar 6 21:58:42 PST 2010


BCS Wrote:
> IIRC zero filling a block is likely cheaper that zero filling holes in it. 
> I'd avoid "=void" unless you know you will be copying structs into the space 
> (that will copy the holes as well). 
And unless you will never compare the struct, as the garbage bits will also be compared.
I was thinking about using void in the struct opCall, bad idea.
Maybe add 

static if( S.sizeof == members.sizeof )
 S s = void;
else
 S s;

:D


More information about the Digitalmars-d-learn mailing list