This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/77434] warn about suspicious precedence of ternary operator (?:)
- From: "bernd.edlinger at hotmail dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 01 Sep 2016 13:43:50 +0000
- Subject: [Bug c++/77434] warn about suspicious precedence of ternary operator (?:)
- Auto-submitted: auto-generated
- References: <bug-77434-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77434
Bernd Edlinger <bernd.edlinger at hotmail dot de> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bernd.edlinger at hotmail dot de
--- Comment #4 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
(In reply to joseph@codesourcery.com from comment #1)
> I think the key thing that makes this suspicious is the boolean context
> combined with both halves of the conditional expression being constant.
> A conditional expression with both halves constant in a boolean context
> either always evaluates to the same value, as here, or could be replaced
> simply by "(COND)" or "(!(COND))".
>
> Alternatively, a conditional expression in a boolean context where either
> half is a constant that's not 0 or 1 is suspicious.
I agree: <= for boolean seems questionable.