3 ms·
They're not any use for pulling sub-byte fields out of network packets in portable code, because everything about the precise layout of bitfields is entirely im
by caf 15y ago
They're not any use for pulling sub-byte fields out of network packets in portable code, because everything about the precise layout of bitfields is entirely implementation-defined. Portable code has to use masking-and-shifting.
The only portable uses of bitfields are to potentially save a little memory, and to get "modulo-power-of-2" behaviour. Bitfields are a classic "not as useful as they first appear" feature.