• 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: cString deprecated!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.
  • Follow-Ups:
    • Re: cString deprecated!
      • From: Ali Ozer <email@hidden>
    • Re: cString deprecated!
      • From: Dustin Voss <email@hidden>
References: 
 >Re: cString deprecated! (From: Dustin Voss <email@hidden>)

  • Prev by Date: Request for Guidance
  • Next by Date: Re: Launching an App without NSWorkspace?
  • Previous by thread: Re: cString deprecated!
  • Next by thread: Re: cString deprecated!
  • Index(es):
    • Date
    • Thread