Relaxing -Wsign-compare
Richard Henderson
rth@redhat.com
Thu Sep 20 16:34:00 GMT 2001
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~
More information about the Gcc
mailing list