Re: !foo vs foo == nil
Re: !foo vs foo == nil
- Subject: Re: !foo vs foo == nil
- From: "John C. Randolph" <email@hidden>
- Date: Wed, 20 Aug 2008 18:14:21 -0700
On Aug 20, 2008, at 5:04 PM, j o a r wrote:
On Aug 20, 2008, at 4:56 PM, John C. Randolph wrote:
Personally, I prefer "if (!foo)" over "if (foo == nil)", because
the latter has the hazard of a typo that compiles. You can lose a
fair bit of time staring at "if (foo = nil)" before you spot the
mistake.
There is a GCC warning to help you with that, but in addition, you
can learn to type:
if (nil == foo)
Problem solved! :-)
...at the cost of five additional keystrokes, not to mention the
aesthetics.
-jcr
_______________________________________________
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