This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Wrong warning? ISO C restricts en umerator values to range of âintâ
- From: "Felipe Contreras" <felipe dot contreras at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Wed, 6 Feb 2008 13:05:24 +0200
- Subject: Wrong warning? ISO C restricts en umerator values to range of âintâ
Hi,
This is what ISO C says:
Each enumerated type shall be compatible with char, a signed integer
type, or an unsigned integer type. The choice of type is
implementation-defined,110) but shall be capable of representing the
values of all the members of the enumeration.
110) An implementation may delay the choice of which integer type
until all enumeration constants have been seen.
The interesting part here is "shall be capable of representing the
values of all the members of the enumeration", sometimes only an
"unsigned int" can do that.
So, shouldn't gcc allow this without warnings then?
typedef enum OMX_ERRORTYPE
{
OMX_ErrorNone = 0,
OMX_ErrorInsufficientResources = 0x80001000
} OMX_ERRORTYPE;
Best regards.
--
Felipe Contreras