开发者

c/c++ single colon [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicate:

What does '开发者_开发问答;unsigned temp:3' means

I'm a newbie to c/c++ and I have this code running on linux and win32

typedef struct tMessageAction
{
    unsigned char ActionId : 4;
    unsigned short ID : 10;
}tMessageAction;

so what are the single colons doing to this variables? are they specifying how many bits are going to be used? is this related to some type of structure alignment attribute?


The colons are defining a bitfield. They do not change the alignment rules.


Here's about the C Bit fields.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜