This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/17896] New: The expression (a>0 & b>0) should give clearer warning message (-Wparentheses)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]