On Thu, Sep 15, 2016 at 01:21:21PM -0600, Jeff Law wrote:
> On 09/05/2016 08:28 AM, Marek Polacek wrote:
> > > test.c:10:8: note: add parentheses around left hand side expression to
> > > silence this warning
> > >     r += !a == ~b;
> > >          ^~
> > >          ( )
> > > 
> > > this will not fix it, but make  it worse.
> > > I think a better warning would be
> > > warning: ~ on boolean value, did you mean ! ?
> > 
> > Could you please open a PR?  I'll take care of it.
> > 
> > Still not sure about other operations.  I guess no one would
> > object to warning on bool1 % bool2, but should we warn for
> > bool1 + bool2?
> Wouldn't the desire for a warning largely depend on the type of the result?
> So I'll assume you're referring to a boolean result :-)
> 
> bool1 + bool2 does have meaning though, even when the result is a bool. You
> have to be leery of both having a true value as that causes an overflow.

Yea.  The version of the patch I posted doesn't warn for addition of booleans.

        Marek

Reply via email to