On Aug 21, 2008, at 3:54 AM, Jules Colding wrote:

For that simple reason, I'd go for nil == foo every time.

Yes, and in general you should always do "if (CONSTANT == foo)" to catch the potential "if (CONSTANT = foo)" error.

If your name is Yoda, then perhaps if (3 != x) reads naturally to you. :-)

As in most things, I think it is critical to strike a balance between code readability/skim-ability and other considerations.

The previously mentioned warning will catch an unintentional assignment as long as you don't overzealously use extra sets of parenthesis.

And to use Uli's example, the compiler will happily accept

        x =+ 5;

even when that isn't what you intended. At the end of the day, you are responsible for what you typed, typos included.

Jim
_______________________________________________

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