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]

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


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