• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Unnecessary Boolean Warning
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unnecessary Boolean Warning


  • Subject: Re: Unnecessary Boolean Warning
  • From: Gordon Apple <email@hidden>
  • Date: Mon, 01 Aug 2011 10:47:47 -0500
  • Thread-topic: Unnecessary Boolean Warning

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

  • Follow-Ups:
    • Re: Unnecessary Boolean Warning
      • From: Greg Parker <email@hidden>
    • Re: Unnecessary Boolean Warning
      • From: Jean-Daniel Dupas <email@hidden>
  • Prev by Date: Re: Telling Auto Save, "No, I'm busy now"
  • Next by Date: ARC and Singletons
  • Previous by thread: Re: Telling Auto Save, "No, I'm busy now"
  • Next by thread: Re: Unnecessary Boolean Warning
  • Index(es):
    • Date
    • Thread