Possible Duplicate:
What does ‘unsigned temp:3’ means
I came across some code like this that I am not sure with:
unsigned long byt开发者_Python百科e_count : 32
unsigned long byte_count2 : 28
What does the :
mean here?
That is a bit field:
a data structure used in computer programming. It consists of a number of adjacent computer memory locations which have been allocated to hold a sequence of bits, stored so that any single bit or group of bits within the set can be addressed. A bit field is most commonly used to represent integral types of known, fixed bit-width...
It's also non-standard. Bit fields must be of type _Bool (C99), signed int or unsigned int. However, GCC allows any integer type. The type affects the alignment of the field, the alignment of any subsequent field, and the overall size of the struct containing the bit-field.
精彩评论