Re: NSString uppercaseString
Re: NSString uppercaseString
- Subject: Re: NSString uppercaseString
- From: Uli Kusterer <email@hidden>
- Date: Fri, 27 Jun 2008 15:30:28 +0200
Am 27.06.2008 um 15:15 schrieb Tito Ciuro:
It's autoreleased.
No, there's no guarantee that it's autoreleased. All that's
guaranteed is that you do not own it. This still means there'll be no
leak and you shouldn't call release on it, but assuming it'
autoreleased would be assuming a longer lifetime than is guaranteed.
If you read the documentation closely, you'll see that it would be
perfectly valid to implement this method so the string goes away when
the original (non-uppercase) string is released.
In the case of uppercaseString, it may actually *be* autoreleased
under the hood, but that's an implementation detail. For example, -
objectAtIndex: in NSArray* is documented the same way as
uppercaseString, but if you release the array itsef, any object you
obtained from the array goes away (unless you or someone else
explicitly retain it).
So, it is NOT guaranteed to be autoreleased, it is just "not owned
by you". Please be careful about spreading inaccuracies not supported
by the documentation.
Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
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