|
|
The same situation applies to the promotion of bit-field values. In ANSI C, if the number of bits in an int or unsigned int bit-field is less than the number of bits in an int, the promoted type is int; otherwise the promoted type is unsigned int. In most older C compilers, the promoted type is unsigned int for explicitly unsigned bit-fields, and int otherwise.
On machines where plain bit-fields represent unsigned values, full-sized bit-fields (for example, 8 bit chars, 16 bit shorts, 32 bit ints, longs, and enums) will be changed for the purpose of code generation to the corresponding unsigned type. Any full-sized bitfield, on any machine, will be changed to a simple type.
Similar use of casts can eliminate situations that are ambiguous.