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: Wrong warning? ISO C restricts enumerator values to range of ‘int’


On 06/02/2008, Felipe Contreras <felipe.contreras@gmail.com> wrote:
> On Feb 6, 2008 1:18 PM, Manuel López-Ibáñez <lopezibanez@gmail.com> wrote:
> > On 06/02/2008, Felipe Contreras <felipe.contreras@gmail.com> wrote:
> > >
> > > So, shouldn't gcc allow this without warnings then?
> > >
> > > typedef enum OMX_ERRORTYPE
> > > {
> > >   OMX_ErrorNone = 0,
> > >   OMX_ErrorInsufficientResources = 0x80001000
> > > } OMX_ERRORTYPE;
> > >
> >

It seems that this is a correct warning.

"Even though the underlying type of an enum is unspecified, the type
of enumeration constants is explicitly defined as int (6.4.4.3/2 in
the C99 Standard)."

from:  http://gcc.gnu.org/ml/gcc-patches/2000-07/msg00993.html

Nonetheless, the comment from Zack is right, so shouldn't we make the
conversion independently of the warning ?


Cheers,

Manuel.


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