This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Relaxing -Wsign-compare
- To: Morten Welinder <terra at diku dot dk>
- Subject: Re: Relaxing -Wsign-compare
- From: Richard Henderson <rth at redhat dot com>
- Date: Thu, 20 Sep 2001 16:34:16 -0700
- Cc: gcc at gcc dot gnu dot org
- References: <20010920154527.26304.qmail@ntyr.diku.dk>
On Thu, Sep 20, 2001 at 03:45:27PM -0000, Morten Welinder wrote:
> Would it be reasonable to silence this warning when one of the sides is
> a constant (in the C meaning) that fits well within the range of the
> other side's type?
No.
C type rules still mandate the promotion of the signed argument to
unsigned. Which means that if you do not know for a fact that the
signed argument is non-negative, you still have a problem. Which
you can't know without data-flow analysis, and the warning is based
simply on the existance of the promotion.
Make 'i' a size_t like it ought to have been in the first place.
r~