9.10.10 packed
The packed
attribute specifies that a structure member
should have the smallest possible alignment unless you specify a larger value with the
aligned
attribute.
Here is a structure in which the member x
is packed, so
that it immediately follows a
, with no padding for alignment:
struct foo
{
char a;
int x[2] __attribute__ ((packed));
};
Note:
PIC32A devices require that words be
aligned on quad-byte boundaries. Care must be taken when using the
packed
attribute to avoid run-time addressing errors; for example,
casting a pointer to an non-packed type may cause the compiler to generate code that
will not correctly execute with misaligned data.