unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Emanuel Berg <incal@dataswamp.org>
To: emacs-devel@gnu.org
Subject: Re: [nongnu] elpa/hyperdrive b5294b4354 4/4: Tidy: Use zerop instead of = 0
Date: Sat, 14 Oct 2023 23:33:11 +0200	[thread overview]
Message-ID: <87edhw7uug.fsf@dataswamp.org> (raw)
In-Reply-To: 87mswmqiif.fsf@posteo.net

Philip Kaludercic wrote:

> FWIW this doesn't matter that much, you can check the
> disassembly to see what is going on after byte compilation:
>
> (disassemble (byte-compile (lambda (a) (= a 0))))

byte code:
  args: (a)
0       varref    a
1       constant  0
2       eqlsign   
3       return    

> (disassemble (byte-compile (lambda (a) (zerop a))))

byte code:
  args: (a)
0       varref    a
1       constant  0
2       eqlsign   
3       return    

They are identical, is that what you mean it doesn't matter
that much?

To use `zerop' is maybe more classy - the attitude being to
minimize everything as much as possible - as it is a unary
function (1 argument) while `=', as it is used here, is binary
(2 arguments).

BTW = can be used unary as well, then it always returns t -
even for nil. (= nil) ; t

But why do that? As it is more classy to just use t :)

-- 
underground experts united
https://dataswamp.org/~incal




  parent reply	other threads:[~2023-10-14 21:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <169722725606.27637.3820182151024041420@vcs2.savannah.gnu.org>
     [not found] ` <20231013200057.2C7FCC09BC9@vcs2.savannah.gnu.org>
2023-10-13 22:12   ` [nongnu] elpa/hyperdrive b5294b4354 4/4: Tidy: Use zerop instead of = 0 Philip Kaludercic
2023-10-13 23:26     ` Joseph Turner
2023-10-14 21:33     ` Emanuel Berg [this message]
2023-10-15  9:17       ` Philip Kaludercic
2023-10-15  9:39         ` Emanuel Berg

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87edhw7uug.fsf@dataswamp.org \
    --to=incal@dataswamp.org \
    --cc=emacs-devel@gnu.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).