• 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: Sean McBride <email@hidden>
  • Date: Mon, 01 Aug 2011 11:56:37 -0400
  • Organization: Rogue Research Inc.

On Sun, 31 Jul 2011 15:13:45 -0500, Gordon Apple said:

>The following expression generates a warning message (3&&2 within 3||2) and
>says to include the 3anded2 expression in parens.  Anybody who understands
>basic boolean operator precedence knows this is unnecessary.  Bug report?
>
>    BOOL isInUse = [super mediaIsInUse];
>    isInUse = isInUse || [self videoIsOn] && ([[self capMgr] isRecording]
>                                              || [[self camVC]
>movieIsPlaying]
>                                              || [[self camVC]
>movieIsPaused]);

This warning has found several bugs (ie incorrect programmer recollection of precedence rules) in at least 2 open source projects I use.  I'm glad we have it.  Turn it off it offends you so.

--
____________________________________________________________
Sean McBride, B. Eng                 email@hidden
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada


_______________________________________________

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

  • Prev by Date: ARC and Singletons
  • Next by Date: Re: ARC and Singletons
  • Previous by thread: Re: Unnecessary Boolean Warning
  • Next by thread: Unnecessary Boolean Warning
  • Index(es):
    • Date
    • Thread