This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/17896] New: The expression (a>0 & b>0) should give clearer warning message (-Wparentheses)
- From: "trt at acm dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Oct 2004 19:55:53 -0000
- Subject: [Bug c/17896] New: The expression (a>0 & b>0) should give clearer warning message (-Wparentheses)
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
gcc -Wparentheses, for the expression:
a & b == c
warns "suggest parentheses around comparison in operand of &".
This is good, but alas the same warning is issued for:
a>0 & b>0
Here it does not matter whether & or && are used, the semantics are identical.
(In my experience, 75% of such instances are "harmless" in this way.)
This deserves a clearer warning such as:
suggest && instead of & when joining booleans
There is a similar issue with || versus |
And also != versus ^ but that is fairly obscure so I will ignore it.
--
Summary: The expression (a>0 & b>0) should give clearer warning
message (-Wparentheses)
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: trt at acm dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17896