• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Empty NSStrings, nil NSStrings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Empty NSStrings, nil NSStrings


  • Subject: Re: Empty NSStrings, nil NSStrings
  • From: Ondra Cada <email@hidden>
  • Date: Sun, 16 Apr 2006 20:13:02 +0200

Joar,

On 16.4.2006, at 20:02, j o a r wrote:

str=[str?:@"" stringByAppendingString:@"whatever"]

Obfuscation...

I beg to differ. In my experience (presumed of course there is no other place around where the same replacement would be needed!), there is *no* more concise, cleaner and intention-revealing way of doing this.


Of course, you can add an extra variable along with extra if or whatever on that line--which all considerably obfuscates the code, compared with this, completely clean and at the first look absolutely intention-revealing: what exactly do you want there? Well, to send a message to str if non-nil, to @"" otherwise. No way to express it (in GNU C) better than by a str?:@"" -- whatever else allows for other possible meanings, the (in)validity of which the reader has to infer from the semantics.

Just keep the following in mind:

<http://developer.apple.com/documentation/MacOSX/Conceptual/ universal_binary/universal_binary_tips/chapter_5_section_22.html>

Ick! Haven't noticed.

Although I do like it in general, I would *much* rather see it as a Leopard thing than an Intel one. This way, I do really and much fear it would mean lotta code in near future work on them Intels only, crashing spectacularly on a decent hardware :(((
---
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
  • Follow-Ups:
    • Re: Empty NSStrings, nil NSStrings
      • From: j o a r <email@hidden>
References: 
 >Empty NSStrings, nil NSStrings (From: Paolo Bertani <email@hidden>)
 >Re: Empty NSStrings, nil NSStrings (From: j o a r <email@hidden>)
 >Re: Empty NSStrings, nil NSStrings (From: Ondra Cada <email@hidden>)
 >Re: Empty NSStrings, nil NSStrings (From: j o a r <email@hidden>)

  • Prev by Date: Re: Open System Preferences?
  • Next by Date: Re: Empty NSStrings, nil NSStrings
  • Previous by thread: Re: Empty NSStrings, nil NSStrings
  • Next by thread: Re: Empty NSStrings, nil NSStrings
  • Index(es):
    • Date
    • Thread