9.56 __attribute__((packed)) type attribute

The packed type attribute specifies that a type must have the smallest possible alignment.


This type attribute is a GNU compiler extension that the ARM compiler supports.


Taking the address of a field with the packed attribute or in a structure with the packed attribute yields a __packed-qualified pointer. The compiler produces a type error if you attempt to implicitly cast this pointer to a non-__packed pointer. This contrasts with its behavior for address-taken fields of a #pragma packed structure.
The compiler generates a warning message if you use this attribute in a typedef.
Related concepts
4.34 The __packed qualifier and unaligned data access in C and C++ code
4.39 Comparisons of an unpacked struct, a __packed struct, and a struct with individually __packed fields, and of a __packed struct and a #pragma packed struct
Related reference
9.63 __attribute__((packed)) variable attribute
9.91 #pragma pack(n)
9.12 __packed
10.4 Structures, unions, enumerations, and bitfields in ARM C and C++
Non-ConfidentialPDF file icon PDF versionARM DUI0375E
Copyright © 2007, 2008, 2011, 2012, 2014 ARM. All rights reserved.