Subject: Re: [GSOC][PATCH] apply: address -Wsign-comparison warnings

From: Junio C Hamano <[email-masked]>
Date: Mon, 24 Feb 2025 06:27:42 -0800

Zejun Zhao <[email-masked]> writes:

> Now I'd like to ask for your advice on this issue, which I may be supposed to 
> do before sending any actual patches, should I push forward this patchset 
> further or pick another microproject?

It really depends on what "this patchset" you mean.

I do think that there are still places in our code base where we
truncate size_t values that we eventually use for allocation by
mistakenly mix arithmetic with smaller type, and I do think it is
worth finding and fixing them.  So a patch that fixes a code path
with such an issue would still be a nice thing to do.  If there such
a change (I do not offhand recall) in the 6 patches from you, that
part of the series may want to be resurrected; but I do not think
changing "int" for line numbers to "size_t" is one of such changes.

If you mean "find anything that -Wsign-compare warns about and
squelch the warning by using widest type common among the quantities
involved in the expression the compiler warns about", I do not think
it is a good idea [*1*].

[Reference]

*1* https://staticthinking.wordpress.com/2023/07/25/wsign-compare-is-garbage/