9 ms·
Bit fields are portable since ages, since C89. Just pack it, use the smallest base type and don't leave holes. We were using them in perl5 forever, and this com
by rurban 4y ago
Bit fields are portable since ages, since C89. Just pack it, use the smallest base type and don't leave holes. We were using them in perl5 forever, and this compiles on more platforms with more compilers then you know. Just use -mms-bitfields on mingw and use unsigned short instead of just unsigned.
E.g. https://www.nntp.perl.org/group/perl.perl5.porters/2008/02/msg133830.html https://www.nntp.perl.org/group/perl.perl5.porters/2008/02/m... for tricks.
- tempodox 4y ago> Bit fields are portable since ages, since C89. Wrong. N1256 (ISO C99 spec), for instance, explicitly states in 6.7.2.1.10: The order of allocation of bit-fields within a unit (high-order to low-order or low-order to high-order) is implementation-defined. Look it up.
- rurban 4y agoIn theory yes, in practice no. And the committee usually has no idea.