10.65 __attribute__((packed)) variable attribute

The packed variable attribute specifies that a variable or structure field has the smallest possible alignment. That is, one byte for a variable, and one bit for a field, unless you specify a larger value with the aligned attribute.


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


    char a;
    int b __attribute__((packed));
} Variable_Attributes_packed_0;
Related concepts
5.35 The __packed qualifier and unaligned data access in C and C++ code
5.40 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
10.57 __attribute__((packed)) type attribute
10.95 #pragma pack(n)
10.12 __packed
11.4 Structures, unions, enumerations, and bitfields in ARM C and C++
Non-Confidential PDF file icon PDF version ARM DUI0472J
Copyright © 2010-2013 ARM. All rights reserved.