all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Óscar Fuentes" <ofv@wanadoo.es>
To: emacs-devel@gnu.org
Subject: Re: Warnings in mingw64 builds on master
Date: Sun, 16 Aug 2020 17:05:41 +0200	[thread overview]
Message-ID: <87zh6uskai.fsf@telefonica.net> (raw)
In-Reply-To: 83sgcniaol.fsf@gnu.org

Eli Zaretskii <eliz@gnu.org> writes:

>> if none of those conditions are true
>
> That cannot happen.

The compiler can't prove that. Such a proof is way too difficult. The
"fix" you are hoping for will not arrive in 10.3. Neither in 20.3,
unless some extraordinary advancements occur.

In any case, the idiom

if( cond1 ) {}
else if(cond2) {}

where one of cond1 or cond2 are true, is questionable. It not only
confuses de compiler, a human reader would reasonably think that those
conditions can be simultaneously false. Something like this would be
clearer:

if( cond1 ) {}
else { // if we reach this point, cond2 is true
assert(cond2); // Honest! And future-proof.
}

This way you are conveying knowledge to both the reader and the
compiler, and even making the code more robust.




  parent reply	other threads:[~2020-08-16 15:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-14 22:37 Warnings in mingw64 builds on master Andy Moreton
2020-08-15 16:24 ` Eli Zaretskii
2020-08-15 18:48   ` Andy Moreton
2020-08-15 19:03     ` Eli Zaretskii
2020-08-15 19:39       ` Andy Moreton
2020-08-15 20:36       ` Óscar Fuentes
2020-08-16  2:31         ` Eli Zaretskii
2020-08-16 11:21           ` Andy Moreton
2020-08-16 14:44             ` Eli Zaretskii
2020-08-16 16:45               ` Óscar Fuentes
2020-08-16 17:08                 ` Eli Zaretskii
2020-08-16 15:05           ` Óscar Fuentes [this message]
2020-08-15 22:34       ` Paul Eggert
2020-08-16  2:31         ` Eli Zaretskii
2020-08-16 15:25           ` Paul Eggert
2020-08-16 15:39             ` Eli Zaretskii
2020-08-17  4:21               ` Paul Eggert
2020-08-17 16:21                 ` 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=87zh6uskai.fsf@telefonica.net \
    --to=ofv@wanadoo.es \
    --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 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.