Subject: Re: bug#45562: [PATCH] Fix "comparison always the same" warnings found by lgtm

From: Stefan Kangas <[email-masked]>
Date: Fri, 1 Jan 2021 10:10:38 -0600

Daniel Martín <[email-masked]> writes:

> Lars Ingebrigtsen <[email-masked]> writes:
>
>> Eli Zaretskii <[email-masked]> writes:
>>
>>>> --- a/src/alloc.c
>>>> +++ b/src/alloc.c
>>>> @@ -4001,7 +4001,7 @@ memory_full (size_t nbytes)
>>>>  	  {
>>>>  	    if (i == 0)
>>>>  	      free (spare_memory[i]);
>>>> -	    else if (i >= 1 && i <= 4)
>>>> +	    else if (i <= 4)
>>>>  	      lisp_align_free (spare_memory[i]);
>>>>  	    else
>>>>  	      lisp_free (spare_memory[i]);
>>>
>>> This is an optimization better left to the compiler, IMO.
>>
>> I think the change made the code slightly clearer, though?  You don't
>> have to think about whether there's anything in the range between 0 and
>>>= 1.
>
> I think it depends on the programmer.  To me, the original code makes
> more clear that the branch runs when i is in the [1..4] range, in a
> mathematical sense.

I liked the new one better myself, but we should probably just leave it
alone if we can't agree.  The difference is minor, in any case.