Wrong warning? ISO C restricts enumerator values to range of ‘int’
Felipe Contreras
felipe.contreras@gmail.com
Wed Feb 6 11:05:00 GMT 2008
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
More information about the Gcc
mailing list