Uli,

As Matt also points out, the documentation is not always crystal- clear, so I was simply trying to answer Sam's specific question. Since not all APIs behave the same way I added the link to the "Memory Management Programming Guide for Cocoa" page, hoping to help Sam. In any case, it was never my intention to spread inaccuracies :-)

Cheers,

-- Tito

On 27 Jun 2008, at 6:30 AM, Uli Kusterer wrote:

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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to