Subject: Re: "comparison is always true" and -fshort-enums
To: Ben Harris <bjh21@netbsd.org>
From: Todd Vierling <tv@wasabisystems.com>
List: tech-toolchain
Date: 12/21/2001 09:45:29
On Fri, 21 Dec 2001, Ben Harris wrote:

: enum.c:6: warning: comparison is always false due to limited range of data
: type

Change the below to:

: enum foo { BAR, BAZ };
: int
: thing(enum foo arg)
: {
>>        int x = arg;
:
>>        if (x < 0)
:                 return 1;
:         else
:                 return 0;
: }

(yes, this is a bit of a hack, as casting should have worked.)

-fshort-enums makes for some rather interesting ABI changes, IIRC.  Is this
part of the ELF supplement for ARM (if there is one)?

-- 
-- Todd Vierling <tv@wasabisystems.com>  *  Wasabi & NetBSD:  Run with it.
-- CDs, Integration, Embedding, Support -- http://www.wasabisystems.com/