Re: bit field alignment

2020-04-27 Thread Andreas Schwab
On Apr 26 2020, Doug McIlroy via Gcc wrote: > What was the rationale for the gcc ABI convention that int > bit fields force the containing struct to be int-aligned? See PCC_BITFIELD_TYPE_MATTERS in the GCC internals documentation. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key finge

Re: bit field alignment

2020-04-27 Thread Florian Weimer via Gcc
* Doug McIlroy via Gcc: > 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. I'm pretty sure that this follow

bit field alignment

2020-04-26 Thread Doug McIlroy via Gcc
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,