This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Relaxing -Wsign-compare


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~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]