On 02/06/2015 08:43 AM, Peter Maydell wrote:
> On 6 February 2015 at 16:20, Richard Henderson <r...@twiddle.net> wrote:
>> It should be enough to simply add the unsigned suffix to the integers as they
>> are, forcing the underlying type to be unsigned.
> 
> I can't see anything in the C99 spec that justifies this
> as a fix... In fact, 6.7.2.2 para 3 says
> "The identifiers in an enumerator list are declared as
> constants that have type int", which sounds to me like it
> means "if you have enum { foo = ..., }; then 'foo' must
> have (signed) integer type even if the representation
> of the enum type is unsigned".

Hum.  True, despite the talk in para 4 about the compatible type of the
enumeration.  Which is why my test worked with a variable of enum type, but
doesn't work with one of the enum members.

Oh well.


r~

Reply via email to