开发者

What does respawn:1 mean in c? [duplicate]

This question already has answers here: 开发者_Python百科 Closed 11 years ago.

Possible Duplicate:

what does this mean in c int a:16; ?

What does the :1 mean here:

...
unsigned respawn:1;
unsigned just_respawn:1;
unsigned detached:1;
unsigned exiting:1;
unsigned exited:1;
} ngx_process_t;


This looks like a bit field in a struct (the header you omitted). The :1 means "1 bit wide", so in your case, they're all booleans. The compiler is supposed to optimize their space usage by packing many of them per byte.


respawn is a bitfield which is 1 bit wide, so it can take on the value of 0 or 1.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜