You copied the Doc URL to your clipboard.

__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.

In non-GNU mode, this attribute is equivalent to __packed, and has stronger constraints than when used in GNU-mode.


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.

Was this page helpful? Yes No