all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefan@marxist.se>
To: "Daniel Martín" <mardani29@yahoo.es>,
	"Lars Ingebrigtsen" <larsi@gnus.org>
Cc: 45562@debbugs.gnu.org
Subject: bug#45562: [PATCH] Fix "comparison always the same" warnings found by lgtm
Date: Fri, 1 Jan 2021 10:10:38 -0600	[thread overview]
Message-ID: <CADwFkmmWgAKQc4J9Y1H-Jeh5y1261d_imCFVE_M-hQR-_yU=Xw@mail.gmail.com> (raw)
In-Reply-To: <m1v9cgripk.fsf@yahoo.es>

Daniel Martín <mardani29@yahoo.es> writes:

> Lars Ingebrigtsen <larsi@gnus.org> writes:
>
>> Eli Zaretskii <eliz@gnu.org> 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.





  reply	other threads:[~2021-01-01 16:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-31  8:33 bug#45562: [PATCH] Fix "comparison always the same" warnings found by lgtm Stefan Kangas
2020-12-31 14:12 ` Eli Zaretskii
2021-01-01 11:08   ` Lars Ingebrigtsen
2021-01-01 11:37     ` Unknown
2021-01-01 16:10       ` Stefan Kangas [this message]
2021-01-01 12:05     ` Eli Zaretskii
2021-01-01 16:21   ` Stefan Kangas
2021-01-01 16:38     ` Andreas Schwab
2021-07-21 11:30       ` Lars Ingebrigtsen
2021-01-01 18:17     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADwFkmmWgAKQc4J9Y1H-Jeh5y1261d_imCFVE_M-hQR-_yU=Xw@mail.gmail.com' \
    --to=stefan@marxist.se \
    --cc=45562@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=mardani29@yahoo.es \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.