Re: Unnecessary Boolean Warning
Re: Unnecessary Boolean Warning
- Subject: Re: Unnecessary Boolean Warning
- From: Jean-Daniel Dupas <email@hidden>
- Date: Mon, 01 Aug 2011 18:21:11 +0200
If this warning bother you, just disable it.
clang is smart enough to tell you what flag you have to turn off in the warning message.
For instance, just add -Wno-constant-logical-operand in your other warning flags.
Le 1 août 2011 à 17:47, Gordon Apple a écrit :
> It’s not that I object to anyone doing it, if that makes them more
> comfortable, but a warning on ““&&” inside of “||”” is ridiculous. Everyone
> knows that multiplication takes precedence over addition. “&&” is a
> multiplication. “||” is, welll, almost an addition. (Exor is addition in a
> mod 2 system.} Anyone who can’t at least keep these two straight shouldn’t
> be doing programming. Overall operator precedence is a little more
> complicated and I would recommend , for those who don’t have it all down,
> copying the page (two page spread) out of K&E or Stroustroup and taping it
> to the wall. (I have done that in the past.) I just think this particular
> warning is carrying things to the extreme. What next? Warning: “*” inside
> of “+”?
>
> I don’t object to warnings. “Assignment inside of “if”” is a good thing,
> because it is a common, easily committed, error, and I appreciate the
> warning.
>
>
> On 7/31/11 8:15 PM, "Graham Cox" <email@hidden> wrote:
>
>>
>> On 01/08/2011, at 6:13 AM, Gordon Apple wrote:
>>
>>> Anybody who understands
>>> basic boolean operator precedence knows this is unnecessary.
>>
>>
>> True, but who does? I mean, sure, if everyone who ever sees your source has
>> that fully committed to heart, you're golden. Otherwise, what's the harm of a
>> few brackets to make it absolutely clear? It's not as if it makes any
>> difference to the object code. Code for readability.
>>
>> --Graham
>>
>>
>>
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
-- Jean-Daniel
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden