Signed bit fields

geoff at utcsstat.UUCP geoff at utcsstat.UUCP
Sat Aug 13 08:54:55 AEST 1983

Despite the tutorial discussion on p. 138 of Kernighan & Ritchie,
which says ``fields are unsigned'', appendix A, the C reference manual,
says in section 8.5 on p. 197:

	The language does not restrict the types of things that are declared
	as fields, but implementations are not required to support any but
	integer fields.  Moreover, even int fields may be considered to be
	unsigned.  On the PDP-11, fields are not signed and have only integer

Thus one is only guaranteed that unsigned fields will be available
in a given implementation, but there may be int or even other fields.
In portable code, one must not assume the existence of fields other
than unsigned fields.

When in doubt, read the manual, not the tutorial.

Geoff Collyer, U. of Toronto

More information about the Comp.lang.c mailing list