enums
T. William Wells
bill at proxftl.UUCP
Fri Jul 29 00:15:28 AEST 1988
3.5.2.2:
"The identifiers in an enumerator list are declared as constants
that have type _int_..."
This says that each of the identifiers declared between the
braces is an integer constant.
Later in the same section:
"Each enumerated type shall be compatible with an integer type;
the choice of type is implementation-defined."
An integer type is a char, all varieties of ints or longs, or an
enumerated type (3.1.2.5).
Thus the compiler writer is at liberty to store something
declared as an enum in whatever size memory is appropriate, and
to sign-extend or not as he sees fit.
This seems to be a slight bug in the standard, as enumeration
types are not required to be able to store the enumeration
constants associated with it, nor to sign extend a short negative
integer stored in an unsigned char.
More information about the Comp.lang.c
mailing list