Unaligned fields in structures

For efficiency, fields in a structure are positioned on their natural size boundary. This means that the compiler often inserts padding between fields to ensure that they are naturally aligned.

When space is at a premium, the __packed qualifier can be used to create structures without padding between fields. Structures can be packed in the following ways:

Note

The same principles apply to unions. You can declare either an entire union as __packed, or use the __packed attribute to identify components of the union that are unaligned in memory.

Show/hideSee also

Copyright © 2010-2011 ARM. All rights reserved.ARM DUI 0472F
Non-ConfidentialID091611