Re: Unnecessary Boolean Warning
Re: Unnecessary Boolean Warning
- Subject: Re: Unnecessary Boolean Warning
- From: Jeffrey Walton <email@hidden>
- Date: Mon, 01 Aug 2011 16:36:00 -0400
On Mon, Aug 1, 2011 at 4:08 PM, Greg Parker <email@hidden> wrote:
>
> On Aug 1, 2011, at 8:47 AM, Gordon Apple wrote:
>
>> 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.
>
> "A warning on `==` inside of `if` is ridiculous. `==` is comparison for equality. `=` is assignment. Anyone who can't at least keep these two straight shouldn't be doing programming."
>
> One programmer's appreciated warning is another programmer's annoying noise. If you think some warning is noise, turn it off. Please don't belittle those of us who are not perfect.
>
I wish I had a dollar for every time I lazy fingered `=` rather than
`==`. And another buck for each time the compiler caught it (I use
`-Wall` -Wextra` and firends).
Jeff
_______________________________________________
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