Minimum target alignment for a datatype

Dale Johannesen dalej@apple.com
Fri Jul 22 18:27:00 GMT 2005


On Jul 22, 2005, at 11:07 AM, Chris Lattner wrote:

>
> Hi All,
>
> I'm trying to determine (in target-independent code) what the 
> *minimum* target alignment of a type is.  For example, on darwin, 
> double's are normally 4-byte aligned, but are 8-byte aligned in some 
> cases (e.g. when they are the first element of a struct).  TYPE_ALIGN 
> on a double returns 8 bytes, is there any way to find out that they 
> may end up being aligned to a 4-byte boundary?

#pragma pack or attribute((__aligned__)) can result in arbitrary 
misalignments for any type.



More information about the Gcc mailing list