struct .sizeof

Frank Benoit keinfarbton at nospam.xyz
Mon Aug 28 16:23:38 PDT 2006


>> has a .sizeof of 16 ? couldn't it fit in 9 bytes ?
>> Thanks.
> 
> Sure it could:
> 
> align (1) struct Foo
> {
>   long a;
>   byte b;
> }
> 
> static assert (Foo.sizeof == 9);

Some more background info:
http://en.wikipedia.org/wiki/Data_structure_alignment



More information about the Digitalmars-d-learn mailing list