66
Section 2: Compiler
TI
-
89 / TI
-
92 Plus Sierra C Assembler Reference Manual
Not for Distribution
Beta Version February 2, 2001
Note:
Since most computers do not allow bits to be addressed directly, it is illegal to take the
address of a bit field. As a result, pointers to bit fields and arrays of bit fields are not
permitted. Furthermore, functions are not allowed to return bit fields.
2.9.7.
Bit Field Internal Representation
Bit fields are packed into memory as efficiently as possible. Each bit field is
placed in the lowest order bits (highest address) available in the specified integer
type. If a bit field does not fit in the remainder of the current integer, it is placed in
a new one (i.e., it cannot span two integers). A bit field declaration without an
identifier is used to force a desired alignment. If the field width is nonzero, the
bits are allocated exactly as if an identifier was present in the declaration; if the
field width is zero, the remainder of the current integer is skipped. For example,
the following declaration causes memory to be allocated as shown:
struct tag {
long int a:10;
long int b:20;
long int c:5;
long int :5;
long int d:8;
long int :0;
long int e:12;
} s;
31
29
9
0
b
a
31
17
9
4
0
d
c
31
11
0
e