Re: !foo vs foo == nil
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