[Top][All Lists]

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

Re: Warnings in mingw64 builds on master

From: Óscar Fuentes
Subject: Re: Warnings in mingw64 builds on master
Date: Sun, 16 Aug 2020 17:05:41 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.91 (gnu/linux)

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

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.

reply via email to

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