你怎么称呼这个:"unsigned int a_bit : 1;"?在位字段之外有使用吗?
What do you call this: "unsigned int a_bit : 1;"? Is there use outside of bit fields?
所以我在使用位域,当我开始考虑创建位域时,例如
struct bit_field{
unsigned int just_a_bit : 1;
unsigned int five_bits : 5;
unsigned int : 3; //Fill to 8 bits
}
你用unsigned int variable : bits;
,这个叫什么(好让我搜一下)?这可以在创建位字段之外使用吗,这样做有什么意义吗?
为清楚起见,"this" 我的意思是在创建变量时在变量名后使用冒号和以位为单位的大小。
那简称为"bit-field"。它只允许在结构(或联合,尽管它在联合中使用 limited)。
成员是个位域。
封装class仍然只是一个class。
所以我在使用位域,当我开始考虑创建位域时,例如
struct bit_field{
unsigned int just_a_bit : 1;
unsigned int five_bits : 5;
unsigned int : 3; //Fill to 8 bits
}
你用unsigned int variable : bits;
,这个叫什么(好让我搜一下)?这可以在创建位字段之外使用吗,这样做有什么意义吗?
为清楚起见,"this" 我的意思是在创建变量时在变量名后使用冒号和以位为单位的大小。
那简称为"bit-field"。它只允许在结构(或联合,尽管它在联合中使用 limited)。
成员是个位域。
封装class仍然只是一个class。