Re: cString deprecated!
Re: cString deprecated!
- Subject: Re: cString deprecated!
- From: Rosyna <email@hidden>
- Date: Thu, 5 Sep 2002 05:04:20 -0700
Ack, at 9/4/02, Dustin Voss said:
I'd actually use the following code:
id string;
CFStringRef cfstring;
cfstring = CFStringCreateWithCString (NULL, theCString, encoding);
string = [self initWithString:(NSString*)cfstring];
Why self? If you do have a method named initWithString in self, then
it's named incorrectly. [NSString
stringWithString:(NSString*)cfstring];
CFRelease (cfstring);
This is *very* bad. You *must* check for NULL cause CFRelease has
this lame thing where it calls abort or something if you pass it
NULL. Even though you can free a NULL.
return string; // or [string autorelease] if this is a
stringWith... method.
reverse that.
--
Sincerely,
Rosyna Keller
Technical Support/Holy Knight/Always needs a hug
Unsanity: Unsane Tools for Insanely Great People
---
Please include any previous correspondence in replies, it helps me
remember what we were talking about. Thanks.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.