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!   :-)

I personally much prefer to have if-statements that clearly evaluate to a boolean value. More intention revealing, and to me that's more important than being terse.

j o a r


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to