4 ms·
The only real problem with C (and C++) bitfields is that the standard doesn’t say anything about how they’re laid out in memory, which unfortunately makes them
by stephencanon 4y ago
The only real problem with C (and C++) bitfields is that the standard doesn’t say anything about how they’re laid out in memory, which unfortunately makes them mostly useless unless you either don’t care about layout or you’re targeting one specific compiler and that compiler documents its choices and doesn’t break them in a few years.
Sign-extension of 1-bit fields also messes people up all the time, but that’s “just” an easy-to-fix bug.
- pclmulqdq 4y agoThat is a really big problem in some applications. I wish the C committee would come out and say "use the layout that GCC 11 .x.x does" to make these a lot more usable.
- stephencanon 4y agoI can't remember if GCC has actually documented their layout choices. Ideally we would pick something documented =)