Bitfield manipulation in C

Bitfields are not quite as portable as you think, as “C gives no guarantee of the ordering of fields within machine words” (The C book)

Ignoring that, used correctly, either method is safe. Both methods also allow symbolic access to integral variables. You can argue that the bitfield method is easier to write, but it also means more code to review.

Leave a Comment