enum, bit fields, cpp...
John Gilmore
gnu at sun.uucp
Wed Feb 29 08:22:42 AEST 1984
The revised C Reference Manual (of June 83) says "The language does not
restrict the types of things that are declared as fields, but
implementations are not required to support any but <unsigned int>
fields."
If you are writing a portable program, declare your bit fields unsigned.
Programs which declare them "int" are asking for trouble.
Apparently the idea that the language could validly transmogrify "int"
bitfields into "unsigned int" has been recanted. Good riddance to it.
(A *compiler* could, as an extension to the language, allow you to say
"int" and actually do "unsigned int" -- but at least now it's not part
of the language definition.)
It's a shame there are no unsigned enums. Seems like a natural;
in fact, if none of the elements are negative, it should figure it out
by itself.
More information about the Comp.lang.c
mailing list