all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Emacs Development <Emacs-devel@gnu.org>
Subject: Re: master 31544bc: Don’t convert pointer to bool
Date: Sat, 20 Mar 2021 10:01:20 -0700	[thread overview]
Message-ID: <b570d9a4-4b95-0ac3-b9ed-457af0b909b4@cs.ucla.edu> (raw)
In-Reply-To: <jwvmtux53cu.fsf-monnier+emacs@gnu.org>

On 3/20/21 7:05 AM, Stefan Monnier wrote:
> Is it right to complain or is that a bug in that tool?
> To my naive intuition, it looks wrong since conversion to bool is
> standard practice when doing `if (ptr) ...`.

'bool b = ptr;' does not work in C89, and can be tricky in C++ as 
witness the now-deprecated "safe bool idiom", so there is some style 
caution here. Also, in my experience 'bool b = ptr;' is more likely to 
be a typo.

Since Emacs assumes C99-or-later this is just a style thing. Still, on 
the whole it seems that the "!!" is a win as it is obvious, consumes 
little room, and makes the unusual conversion clearer to the reader.



  reply	other threads:[~2021-03-20 17:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210320004804.9441.45535@vcs0.savannah.gnu.org>
     [not found] ` <20210320004805.B7BBF2101A@vcs0.savannah.gnu.org>
2021-03-20 14:05   ` master 31544bc: Don’t convert pointer to bool Stefan Monnier
2021-03-20 17:01     ` Paul Eggert [this message]
2021-03-20 18:21     ` Matt Armstrong

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=b570d9a4-4b95-0ac3-b9ed-457af0b909b4@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=Emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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.