Error trying to define a 1,024-bit (128 Byte) Bit Field

前端 未结 4 1785
走了就别回头了
走了就别回头了 2021-01-06 10:32

I would like to define a large bitfield for the purpose of quickly monitoring the status a very large structure of elements. Here is what I have so far:

#define T         


        
4条回答
  •  心在旅途
    2021-01-06 10:56

    Bit fields must fit within a single int, you can't use arbitrary sizes. Honestly the ANSI bitfield implementation is kinda broken. It misses a lot of other stuff too, like control over padding and layout that real-world applications usually need. I'd consider writing some macros or accessor functions to abstract the larger sizes and giving up on the bitfield syntax.

提交回复
热议问题