Wrong warning? ISO C restricts enumerator values to range of ‘int’

Vincent Lefevre vincent+gcc@vinc17.org
Wed Feb 6 16:58:00 GMT 2008


On 2008-02-06 14:59:21 -0000, Dave Korn wrote:
>   So, how about
> 
>  typedef enum OMX_ERRORTYPE
>  {
>    OMX_ErrorNone = 0,
>    OMX_ErrorInsufficientResources = (int)0x80001000
>  } OMX_ERRORTYPE;
> 
> ?

You should get a warning in the cases where 0x80001000 isn't
representable in an int because it is an implementation-defined
behavior. Is there any reason why gcc doesn't issue one?

-- 
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)



More information about the Gcc mailing list