Menu

#326 Option to pack bitfields

open
nobody
None
5
2011-07-05
2011-07-05
wek
No

The current implementation (as of version 3.0) of bitfields in SDCC is, that if the next field would cross an 8-bit boundary, a padding is added.

While this implementation is C99 compliant, often it is desired that bitfields are packed tigthly, both for memory efficiency and interoperability with programs using other compilers.

For the PIC16 target, there is an (undocumented) option to pack bitfields through defining system variable PIC16_PACKED_BITFIELDS, but it might be a better idea to control bitfield packing individually, possibly through a (nonstandard) qualifier,or a #pragma.

I am aware that this means substantial amount of work, not only in compStructSize() of SDCCsymt.c, but also in the back-ends.

Discussion


Log in to post a comment.