This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: underlying type for enums


On Tue, Dec 02, 2003 at 09:31:16AM -0800, Zack Weinberg wrote:
> But is this the right way to look at it?  How do we handle "int foo :8"
> and why is it different (apparently) from the way we handle 
> "enum blah foo :8" ?

For C90 we must choose a compatible type that is a standard integer type.
Due to existing ABI constraints, this must be "unsigned int" most of the
time, and (for 32-bit targets) "int" the rest of the time.  "long" should
not enter into it at all until it's larger than "int", and "long long" is
not a standard type in C90, so we have to pedwarn if we must use it.

Due to the ABI constraints, you can tell when we've cheated and used 
something smaller than int based on promotion rules.

As for the rest of your question, it depends on how C90 interprets
the type of "int foo:8".  I'll go into the office today and locate
my dead tree edition of C90...


r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]