5.34 Pack Pragma
Use this pragma directive to specify the maximum alignment of struct
and
union
members.
The #pragma pack
directive affects declarations of structures following
the pragma directive to the next #pragma pack
or the end of the
compilation unit.
Use either __packed
or #pragma pack
to relax the
alignment restrictions for a type and the objects defined using that type. Mixing
__packed
and #pragma pack
might lead to unexpected
behavior.
Note: This can result in significantly larger and slower code when accessing members of the
structure.
Suggested Replacement
Not officially supported by XC32.
Caveats
None.
Examples
Consider migrating IAR code such
as:
#pragma pack(n)
#pragma pack()
#pragma pack({push|pop}[,name] [,n])
to
MPLAB XC codes similar
to:#pragma pack(n)
#pragma pack()
#pragma pack({push|pop}[,name] [,n])
Further Information
None.