emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Emacs-diffs] master 74f54af: Use eassume (false) for branch that's


From: Paul Eggert
Subject: Re: [Emacs-diffs] master 74f54af: Use eassume (false) for branch that's never taken.
Date: Fri, 19 Apr 2019 12:04:51 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

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 via email to

[Prev in Thread] Current Thread [Next in Thread]