Re: [PATCH] sign-compare: 32-bit support
On Wed, Dec 04, 2024 at 02:47:22PM +0900, Junio C Hamano wrote:
Show 10 quoted lines
> On 32-bit platforms, ssize_t may be "int" while size_t may be
> "unsigned int". At times we compare the number of bytes we read
> stored in a ssize_t variable with "unsigned int", but that is done
> after we check that we did not get an error return (which is
> negative---and that is the whole reason why we used ssize_t and not
> size_t), so these comparisons are safe.
>
> But compilers may not realize that. Cast these to size_t to work
> around the false positives. On platforms with size_t/ssize_t wider
> than a normal int, this won't be an issue.
Thanks for the patch! Will include in v3.
Patrick