What was the rationale for the gcc ABI convention that int
bit fields force the containing struct to be int-aligned?

For example, the size of struct{int x:2;} is 4 in Linux
gcc, completely wasting 3 out of every 4 bytes of memory.

One can get finer alignment by declaring small fields
to be char, but this is non-portable because char bit
fields are an optional feature of the C standard.

Doug McIlroy

Reply via email to