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, 2 Dec 2003, Richard Henderson wrote:

> The easiest way to handle the enum bitfield thing, it would seem,
> would be to take the extended integer type route and follow the
> lead of C++ and define a type with the minimal TYPE_PRECISION
> for the enumerator values.  This brings up a number of issues:

There's also the strange code in c_common_signed_or_unsigned_type checking
modes rather than precisions with a comment referring to how C++ does
this.  Getting proper diagnostics for overflow of bit-field types requires
changes to this (for now I'm keeping the existing behaviour for enum
types).

>     This is almost certainly technically wrong, since to my reading
>     compatible enumerators must have the exact same values.  Also, 

AFAICT compatible enumerators must be the exactly same type, not just have 
the same values; there's no indication that compatibility (with the same 
integer type) is transitive here; PR 6024.

-- 
Joseph S. Myers
jsm@polyomino.org.uk


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