• 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: NSString uppercaseString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSString uppercaseString


  • Subject: Re: NSString uppercaseString
  • From: Tito Ciuro <email@hidden>
  • Date: Fri, 27 Jun 2008 07:12:33 -0700

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 (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


  • Follow-Ups:
    • Re: NSString uppercaseString
      • From: Sam Mo <email@hidden>
References: 
 >NSString uppercaseString (From: "Sam Mo" <email@hidden>)
 >Re: NSString uppercaseString (From: Tito Ciuro <email@hidden>)
 >Re: NSString uppercaseString (From: Uli Kusterer <email@hidden>)

  • Prev by Date: Re: NSString uppercaseString
  • Next by Date: Re: Prevent Asynchronous operation of beginSheetModalForWindow
  • Previous by thread: Re: NSString uppercaseString
  • Next by thread: Re: NSString uppercaseString
  • Index(es):
    • Date
    • Thread