struct field alignment

Fawzi Mohamed fawzi at gmx.ch
Mon Oct 18 10:36:11 PDT 2010


On 18-ott-10, at 04:00, Walter Bright wrote:

> http://www.digitalmars.com/d/2.0/attribute.html#align
>
> Over time, it has become clear to me that there are only two useful  
> alignments:
>
>  align     // set to whatever the C ABI alignment is
>  align(1)  // pack everything in, no alignment padding
>
> I think any other alignments should be deprecated. Note that with  
> align(1), any alignment is achievable simply by adding in byte  
> fields where desired.

I fully agree that those two are the only really useful alignment  
properties for fields in a struct.
Another thing that is needed is specifying the alignment of the struct  
itself, for example if it contains fields that one wants to use with  
SSE.
So one should have the freedom to specify the wanted alignment for the  
structure

Fawzi


More information about the Digitalmars-d mailing list