This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix for short-enums comparison bug
- To: Gavin Romig-Koch <gavin at cygnus dot com>
- Subject: Re: [PATCH] Fix for short-enums comparison bug
- From: Jeffrey A Law <law at hurl dot cygnus dot com>
- Date: Thu, 11 Feb 1999 10:31:58 -0700
- cc: Charles G Waldman <cgw at alum dot mit dot edu>, egcs at egcs dot cygnus dot com
- Reply-To: law at cygnus dot com
In message <14018.60839.325601.426391@cetus.cygnus.com>you write:
> c89 and c9x say that enumerations have to act like some other integer type.
> Which integer type is implementation defined, and can vary from enumeration
> to enumeration, but it has to be capable of representing all the values
> in the enumeration.
Yes the underlying type must be capable of representing all the values for
the enum. But does the enum restrict the actual values which can be used
with the expected results?
My quick read of the C++ standard made it appear as if assigning a value that
was not a member of the enum resulted in undefined results. Is this possibly a
case where C++ and C differ?
jeff