Re: What is the life of the c string returned by NSString's UTF8String method?
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