Re: Empty NSStrings, nil NSStrings
Re: Empty NSStrings, nil NSStrings
- Subject: Re: Empty NSStrings, nil NSStrings
- From: Ondra Cada <email@hidden>
- Date: Sun, 16 Apr 2006 20:41:28 +0200
Just for Paolo's (or other beginner's) benefit, I can see a possible
obfuscation point in the order or Joar's operands (again, sorry if I
am wrong and it was completely clear to all readers):
On 16.4.2006, at 20:25, j o a r wrote:
((nil != foo) ? ...);
though I myself don't like the pattern of using "nil <comparation>
<expression>", there is a point there: in case you are checking for
equality, like
if (nil==foo) ...
and by a typo miss one character writing
if (nil=foo) ....
instead, the compiler would go wild and you can fix the error. If you
did the same mistake in the more common order ("if (foo==nil)"), the
compiler would not even warn (unless you set -Wparentheses, which has
its own drawbacks), and the code would not do what you wanted it to.
(Myself, I much prefer the approach "is there the foo object?"
instead to the "is the foo variable content nil?" one--in other
words, I would always test "if (!foo) ..." instead of "if
(foo==nil)". But that, as Joar rightly says, is a matter of personal
preference.)
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden