9.10.11 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: dsPIC33C/E/F and dsPIC30F device architectures require
that words be aligned on even byte boundaries. dsPIC33A 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.