Size of a bitfield member?

后端 未结 6 1091
傲寒
傲寒 2020-12-29 07:42

Would anyone know how to extract the size of a bit-field member. The below code naturally gives me the size of an integer, but how do I find out how many bits or b

6条回答
  •  南笙
    南笙 (楼主)
    2020-12-29 07:56

    Because of padding it is not possible to see number of bits in a bit field using sizeof operator.

    The only way is to open up the header where the structure is defined, and look it up.

提交回复
热议问题