Re: NSStrings obtained from CFStrings
Re: NSStrings obtained from CFStrings
- Subject: Re: NSStrings obtained from CFStrings
- From: Wesley Miaw <email@hidden>
- Date: Thu, 3 Apr 2003 12:16:59 -0500
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
The convention suggested by Apple is to have whoever did the explicit
alloc, copy, or retain to be responsible for releasing it. e.g.
[NSArray arrayWithCapacity:x] would have been returned to you with
autorelease, but [[NSArray alloc] initWithCapacity:x] is your
responsibility to release.
On Thursday, April 3, 2003, at 01:00 AM,
email@hidden wrote:
My question is, if I have a utility function that takes a CFTreeRef and
returns the NSString value of that node, what's the "kosher" way to do
this?
Should I "retain" the string and then return it? Can you "retain" a
CFString? Here's what I mean:
NSString *string = (NSString *) CFXMLNodeGetString(blah);
return [[string retain] autorelease];
When the CFString comes out of CFXMLNodeGetString() what's it's
refcount?
- --
Wesley Miaw, Wesley Miaw Consulting
http://www.wesman.net/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (Darwin)
iD8DBQE+jGyOQv4agqRAk2kRAtnSAKCt+csyg8R22QnS57m5DwPAX1p/wACfTUai
5Tz86FjtGiaYqgNiLxGzw5g=
=iQDH
-----END PGP SIGNATURE-----
_______________________________________________
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.