2 ms·
Kinda important part mentioned in the link is > Adjacent bit field members may be packed to share and straddle the individual bytes. So it might not be packed
by gray_-_wolf 6y ago
Kinda important part mentioned in the link is
> Adjacent bit field members may be packed to share and straddle the individual bytes.
So it might not be packed. Ofc it usually is, at least on gcc and such.
- hermitdev 6y agoI think the bigger issue in regards to networking is ordering, not the (lack of) packing. I don't think the ordering is guaranteed and probably depends on CPU architecture (e.g. big vs little endian), not necessarily compiler.
- gdwatson 6y agoIn practice, little-endian machines have the first bit field in the least-significant bits of the data type they fit into (usually but not always an int), and big-endian machines have the first bit field in the most-significant bits.