C: A Reference Manual, 5th Edition
page 155, pharagraph 1:
A bit field of
n bits can represent unsigned integers in the range of 0 through 2^
n-1 and
signed integers in the range -2^
n-1 through 2^
n-1 -1, assuming a twos-complement represen-
tation of signed integers. The origional definition of C permitted only bit fields of type
un-
signed, but Standard C permits bit fields to be of type
unsigned int,
signed int, or just
int, termed
unsigned,
signed, and
plain bit fields. Like plain char-
acters, a plain bit field may be signed or unsigned. Some C implementations allow bit
fields of any integer type including
char. C99 allows bit fields of type
_Bool.
Page 156, pharagraph 2:
Compilers are free to impose constraints on the maximum size of a bit field and
specify certain addressing boundaries that bit fields cannot cross. These alignment restric-
tions are usually related to the natural word size of the target computer. When a field is too
long for the computer, the compiler will issue an appropriate error message. When a field
would cross a word boundary, it may be moved to the next word.
Page 197, footnote of
Table 6-5:
a Bit fields of type
int,
signed int, or
unsigned int are assumed to have a conversion rank
less than
int, which means that their converted type depends on whether all their values can be represented in type
int.