• 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: NSString initWithFormat and stringWith
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSString initWithFormat and stringWith


  • Subject: Re: NSString initWithFormat and stringWith
  • From: Bill Bumgarner <email@hidden>
  • Date: Wed, 27 May 2009 20:23:16 -0700

On May 27, 2009, at 8:20 PM, Andy Lee wrote:
I just noticed an earlier message in this thread that points out that stringWithString: does in fact do the same optimization as - copy for constant strings. So the approach in Apple's sample code does not protect from the bundle unloading problem. Aside from the OTHER_CFLAGS approach Jesper describes, the only solution I can think of is to use [NSMutableString stringWithString:] instead of [NSString stringWithString:].

But of course this is an odd case, and the vast majority of the time it's just wasted code to say stringWithString:@"abc".

If you find something that is causing a bundle with Objective-C code to be unloaded, please file a bug via http://bugreport.apple.com/.


It isn't supported and the number of edge cases are both vast and subtle to the point of "it just does not work, don't do it.".

(And it really won't work with GC turned on)

b.bum

_______________________________________________

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


References: 
 >Re: NSString initWithFormat and stringWith (From: Andy Lee <email@hidden>)
 >Re: NSString initWithFormat and stringWith (From: Jesper Storm Bache <email@hidden>)
 >Re: NSString initWithFormat and stringWith (From: Andy Lee <email@hidden>)

  • Prev by Date: Re: How determine if file is in Trash, given Path or Alias
  • Next by Date: Re: [NSApp presentError:error] & Custom Icon ...
  • Previous by thread: Re: NSString initWithFormat and stringWith
  • Next by thread: Re: NSString initWithFormat and stringWith
  • Index(es):
    • Date
    • Thread