Subject: Re: "comparison is always true" and -fshort-enums
To: Ben Harris <>
From: Martin Husemann <>
List: tech-toolchain
Date: 12/23/2001 11:10:51
> This warning is correct (the enum is being represented as an unsigned
> char), but the test is useful on other architectures, so I'd rather not
> remove it.

Just out of curiosity, can you elaborate how/why the test is usefull on other
archs? Besides some (IMHO) realy bad hacks I can't imagine why this if would
make sense.

The only thing that springs to my mind is checking for arbitrary ints passed
insted of enum values, which I would test via a double cast in this case:

  if ((unsigned int)arg > (unsigned int)BAZ)	/* arg not in enum foo */

But basically I would consider such calls illegal.