Solaris 64-bit Developer's Guide

Alignment Issues

There is one additional issue around the alignment of 32-bit long long elements in data structures; i386 applications only align long long elements on 32-bit boundaries, while the amd64 ABI places long long elements on 64-bit boundaries potentially generating wider holes in the data structures. This is different to SPARC where 32-bit or 64-bit, long long items were aligned on 64-bit boundaries.

The following table shows the data type alignment for the designated architectures.

Table 6–2 Data Type Alignment

Architecture 

long long 

double 

long double 

i386 

amd64 

16 

sparcv8 

sparcv9 

16 

Although code might already appear to be LP64 clean on SPARC systems, the alignment differences might produce problems when copying data structures between 32-bit and 64-bit programming environments. These programming environments include device driver ioctl routines, doors routines or other IPC mechanisms. Alignment problems can be avoided by careful coding of these interfaces, and by judicious use of the #pragma pack or _Pack directives.