• 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: !foo vs foo == nil
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: !foo vs foo == nil


  • Subject: Re: !foo vs foo == nil
  • From: Jim Correia <email@hidden>
  • Date: Thu, 21 Aug 2008 15:45:40 -0400

On Aug 20, 2008, at 9:31 PM, Marcel Weiher wrote:

I was swayed by the "nil == foo" arguments for a while, but my gut kept tugging at me and now I have switched back to just if ( !foo), or better (I prefer positive ifs), if (foo). Of course, if all the if (foo) is protecting is a message-send, you can just leave it out altogether and let nil do its thing to messages...

For the sake of completeness (I know Marcel knows the rule), if you are using the return value of a message send, the value will be undefined depending on return type when sending a message to nil. See the runtime documentation for details.


Jim
_______________________________________________

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: !foo vs foo == nil
      • From: "Shawn Erickson" <email@hidden>
References: 
 >!foo vs foo == nil (From: Torsten Curdt <email@hidden>)
 >Re: !foo vs foo == nil (From: Filip van der Meeren <email@hidden>)
 >Re: !foo vs foo == nil (From: Torsten Curdt <email@hidden>)
 >Re: !foo vs foo == nil (From: "John C. Randolph" <email@hidden>)
 >Re: !foo vs foo == nil (From: j o a r <email@hidden>)
 >Re: !foo vs foo == nil (From: "John C. Randolph" <email@hidden>)
 >Re: !foo vs foo == nil (From: Marcel Weiher <email@hidden>)

  • Prev by Date: Re: !foo vs foo == nil
  • Next by Date: Scaling an NSImage makes the edges disappear.
  • Previous by thread: Re: !foo vs foo == nil
  • Next by thread: Re: !foo vs foo == nil
  • Index(es):
    • Date
    • Thread