• 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: What is the life of the c string returned by NSString's UTF8String method?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What is the life of the c string returned by NSString's UTF8String method?


  • Subject: Re: What is the life of the c string returned by NSString's UTF8String method?
  • From: Stuart Malin <email@hidden>
  • Date: Fri, 18 Sep 2009 15:22:10 -0400


On Sep 18, 2009, at 2:20 PM, Sean McBride wrote:

On 9/18/09 2:04 PM, Stuart Malin said:

I have a class with some (statically allocated) class variables. In
the class's -initialize method, I create a retained NSString. I set
one of the class variables to the value returned by -UTF8String (as
sent to that retained NSString).  I use this char* value in some C
calls made from instance methods of the class.

It would be much safer to just call -UTF8String as needed. Or have you
found that it is a bottleneck in your code?


Not a bottleneck, merely another case of misguided attempt to "optimize."
Gotta learn not to do that unless the need is proven.


_______________________________________________

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: 
 >What is the life of the c string returned by NSString's UTF8String method? (From: Stuart Malin <email@hidden>)
 >Re: What is the life of the c string returned by NSString's UTF8String method? (From: "Sean McBride" <email@hidden>)

  • Prev by Date: Re: Finding user's Music folder (and others)?
  • Next by Date: Re: What is the life of the c string returned by NSString's UTF8String method?
  • Previous by thread: Re: What is the life of the c string returned by NSString's UTF8String method?
  • Next by thread: Re: What is the life of the c string returned by NSString's UTF8String method?
  • Index(es):
    • Date
    • Thread