相关疑难解决方法(0)

结构或联合中的'unsigned temp:3'是什么意思?

可能重复:
这个C++代码是什么意思?

我正在尝试使用JNA将C结构映射到Java.我遇到了一些我从未见过的东西.

struct定义如下:

struct op 
{
    unsigned op_type:9;  //---> what does this mean? 
    unsigned op_opt:1; 
    unsigned op_latefree:1; 
    unsigned op_latefreed:1; 
    unsigned op_attached:1; 
    unsigned op_spare:3; 
    U8 op_flags; 
    U8 op_private;
};
Run Code Online (Sandbox Code Playgroud)

你可以看到一些变量被定义为unsigned op_attached:1,我不确定这意味着什么.这会影响为这个特定变量分配的字节数吗?

c c++ colon bit-fields

57
推荐指数
3
解决办法
1万
查看次数

标签 统计

bit-fields ×1

c ×1

c++ ×1

colon ×1