对于位域,分配多少全是是编译器自己的事情。
标准仅仅说了一句话,初始分配足够的空间,如果下一个相邻的位域能够容纳进去,则放进该空间。
至于初始空间是多少,则看实现了。
An implementation may allocate any addressable storage unit large enough to hold a bitfield. If enough space remains, a bit-field that immediately follows another bit-field in a structure shall be packed into adjacent bits of the same unit. If insufficient space remains, whether a bit-field that does not fit is put into the next unit or overlaps adjacent units is implementation-defined. The order of allocation of bit-fields within a unit (high-order to low-order or low-order to high-order) is implementation-defined. The alignment of the addressable storage unit is unspecified.
【 在 blippman 的大作中提到: 】
: 确实windows 平台有些场景下, 结构体的位宽是生效的,
: 比如
: typedef struct
: ...................
--来自微水木3.5.11
--
FROM 140.206.195.*