Sylvain Munaut wrote:
How was it incorrect before?
According to specs, enum types _can_ be unsigned and so the test would be always false.
Ok. I thought perhaps the first enum was set to 0, which guarantees that all following enums are positive integers.
They are all positive integers ...
That's only certain if one enum value is defined to >= 0, and no later enum is defined to < 0. If no enum value is defined at all, then they may very well be negative.
And since the enum type in this case is unsigned, an unsigned value can never be inferior to 0 and so the test is always false.
enums don't have signedness AFAIU?
//Peter