c/c++ single colon [duplicate]
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.
精彩评论