Reading about D: few questions

Trass3r un at known.com
Fri Dec 23 11:54:34 PST 2011


> 5. Align attribute.
>
> http://dlang.org/attribute.html#align
>
> struct S {
>    align(4) byte a; // placed at offset 0
>    align(4) byte b; // placed at offset 1
> }
>
> Explain this please.

align is a huge mess imo.
"It matches the corresponding C compiler behavior"
So what's the point of align in the first place, if the compiler does what  
it wants anyway, see above?

The only thing that really works is

align(1) struct S {...}

for packed structs.


More information about the Digitalmars-d-learn mailing list