3 ms·
> The assumed behaviour of bit fields is well defined between gcc and clang with the proper pragmas. From the GCC documentation[1], it says: > Determined by A
by kbumsik 9y ago
> The assumed behaviour of bit fields is well defined between gcc and clang with the proper pragmas.
From the GCC documentation[1], it says:
> Determined by ABI.
This means that it may be different when compiling for different architectures. How you can say it well-defined? Here is a good example [2] on the compability issue when using bit fields
[1]: https://gcc.gnu.org/onlinedocs/gcc/Structures-unions-enumerations-and-bit-fields-implementation.html https://gcc.gnu.org/onlinedocs/gcc/Structures-unions-enumera...
[2]: http://mjfrazer.org/mjfrazer/bitfields/ http://mjfrazer.org/mjfrazer/bitfields/
- jcelerier 9y ago> This means that it may be different when compiling for different architectures. How you can say it well-defined? In an immense majority of case you won't be serializing or exchanging your bitfields over the network ; this is entirely a non-problem.
- aetherspawn 9y agoYeah, this is a case where it matters. But you can also see the workaround is pretty straightforward here.