The _Packed qualifier (C only)

The z/OS® XL C compiler aligns structure and union members according to their natural byte boundaries and ends the structure or union on its natural boundary. However, since the alignment of a structure or union is that of the member with the largest alignment requirement, the compiler may add padding to elements whose byte boundaries are smaller than this requirement. You can use the _Packed qualifier to remove padding between members of structures or unions. Packed and nonpacked structures and unions have different storage layouts.

Consider the following example:
union uu{
   short    a;
   struct {
      char x;
      char y;
      char z;
   } b;
};

union uu           nonpacked[2];
_Packed union uu   packed[2];
In the array of unions nonpacked, since the largest alignment requirement among the union members is that of short a, namely, 2 bytes, one byte of padding is added at the end of each union in the array to enforce this requirement:
         ┌───── nonpacked[0] ─────────── nonpacked[1] ───┐
         │                       │                       │
         │     a     │           │     a     │           │
         │  x  │  y  │  z  │     │  x  │  y  │  z  │     │
         ⋘─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘

         0     1     2     3     4     5     6     7     8
In the array of unions packed, each union has a length of only 3 bytes, as opposed to the 4 bytes of the previous case:
         ┌─── packed[0] ───┬─── packed[1] ───┐
         │                 │                 │
         │     a     │     │     a     │     │
         │  x  │  y  │  z  │  x  │  y  │  z  │
         ⋘─────┴─────┴─────┴─────┴─────┴─────┘
         0     1     2     3     4     5     6
Note: When the _Packed qualifier is used, the compiler removes padding between members of structures or unions, regardless of the member type.

If you specify the _Packed qualifier on a structure or union that contains a structure or union as a member, the qualifier is not passed on to the nested structure or union.