struct bitfield max size (C99, C++)

后端 未结 4 1275
不知归路
不知归路 2020-12-06 01:47

What is maximal bit width for bit struct field?

struct i { long long i:127;}

Can I define a bit field inside struct, with size of bitfield

4条回答
  •  南笙
    南笙 (楼主)
    2020-12-06 02:01

    Typically, you cannot allocate more bits than the underlying type has. If long long is 64 bits, then your bitfield is probably limited to :64.

提交回复
热议问题