开发者

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

开发者 https://www.devze.com 2023-03-08 17:56 出处:网络
This question already has answers here: 开发者_Python百科 Closed 11 years ago. Possible 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

精彩评论

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