I\'m working on EBDS protocol interface for Windows and Linux. I\'m trying to pack all the data required by the protocol into structs, then I write the struct itself and all the
C++ standard does not specify how bit fields are exactly laid out. Many compilers will use regular integers for each bit field components, which means faster processing but larger structs, unless you specify a different preference which you have done in case of Linux.
See here for the algorithm VS2010 uses.
Edit: There is a problem with your code. Remember that with a signed base type, one bit of the bit field will be consumed by the sign bit. And your enums (like most people's) may be signed (whether they are, is implementation defined) and thus you may see surprises when you store E_EXTENDED_COMMANDS
in mMessageType
and immediately find out that the value is not there.
With recent compilers, you can force the enums to be unsigned and avoid this problem.