Datasheet

ARM Compiler Reference
ARM DUI 0067D Copyright © 1999-2001 ARM Limited. All rights reserved. 3-13
Note
The ARM-Thumb Procedure Call Standard requires that the stack is
8-byte aligned at all external interfaces. The ARM compilers and C
libraries ensure that 8-byte alignment of the stack is maintained. In
addition, the default C library memory model maintains 8-byte alignment
of the heap.
__packed
The
__packed
qualifier sets the alignment of any valid type to 1. This
means:
there is no padding inserted to align the packed object
objects of packed type are read or written using unaligned accesses.
The
__packed
qualifier cannot be used on:
floating-point types
structures or unions with floating-point fields
structures that were previously declared without
__packed
.
Note
__packed
is not, strictly speaking, a type qualifier. It is included in this
section because it behaves like a type qualifier in most respects.
The
__packed
qualifier does not affect local variables of integral type.
The
__packed
qualifier applies to all members of a structure or union
when it is declared using
__packed
. There is no padding between
members, or at the end of the structure. All substructures of a packed
structure must be declared using
__packed
. Integral subfields of an
unpacked structure can be packed individually.
A packed structure or union is not assignment-compatible with the
corresponding unpacked structure. Because the structures have a
different memory layout, the only way to assign a packed structure to an
unpacked structure is by a field-by-field copy.
The effect of casting away
__packed
is undefined. The effect of casting a
nonpacked structure to a packed structure is undefined. A pointer to an
integral type can be legally cast, explicitly or implicitly, to a pointer to a
packed integral type.
A pointer can point to a packed type (Example 3-2 on page 3-14).