unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Eli Zaretskii <eliz@gnu.org>, Philipp Stephani <p.stephani2@gmail.com>
Cc: phst@google.com, emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] master 74f54af: Use eassume (false) for branch that's never taken.
Date: Fri, 19 Apr 2019 12:04:51 -0700	[thread overview]
Message-ID: <9b3a1717-64de-795a-2acf-0698576caf02@cs.ucla.edu> (raw)
In-Reply-To: <83ef5ycnny.fsf@gnu.org>

On 4/19/19 3:08 AM, Eli Zaretskii wrote:
> When ENABLE_CHECKING is not defined, which happens in every production
> build, eassume expands to code that has no side effects, so the
> function will return a random value to its caller.  I don't think this
> is desired.

It looks OK to me. The default branch is impossible, so the function
cannot return a random value to its caller. Although GCC is not smart
enough to deduce this fact, eassume lets the programmer communicate it
to GCC so that GCC doesn't issue a false-alarm diagnostic (and GCC also
can generate better code). When ENABLE_CHECKING is defined, there's also
a runtime check that the impossible does not happen, but this extra
check isn't needed in ordinary production.

This would all be simpler if we replaced 'enum nonlocal_exit' with a
simple boolean. The enum seems to be more trouble than it's worth, if
it's causing this sort of bikeshedding. Not every boolean deserves an
enum just for it.




  reply	other threads:[~2019-04-19 19:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-19  8:43 [Emacs-diffs] master 74f54af: Use eassume (false) for branch that's never taken Eli Zaretskii
2019-04-19  9:52 ` Philipp Stephani
2019-04-19 10:08   ` Eli Zaretskii
2019-04-19 19:04     ` Paul Eggert [this message]
2019-04-19 19:14       ` Philipp Stephani
2019-04-19 20:16         ` Eli Zaretskii
2019-04-19 20:14       ` Eli Zaretskii
2019-04-19 23:00         ` Paul Eggert
2019-04-20  6:25           ` Eli Zaretskii
2019-04-23  0:52             ` Paul Eggert
2019-04-23  6:19               ` Eli Zaretskii
2019-04-23 16:56                 ` Paul Eggert
2019-04-23 17:19                   ` 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

  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=9b3a1717-64de-795a-2acf-0698576caf02@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=p.stephani2@gmail.com \
    --cc=phst@google.com \
    /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).