• 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: Should objects returned by indirection be autoreleased
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Should objects returned by indirection be autoreleased


  • Subject: Re: Should objects returned by indirection be autoreleased
  • From: Greg Hurrell <email@hidden>
  • Date: Fri, 12 May 2006 11:18:32 +0200

El 12/05/2006, a las 2:15, Eric escribió:

For example, this NSFormatter method:

- (BOOL)getObjectValue:(id *)anObject forString:(NSString *)string
errorDescription:(NSString **)error

Should the two indirectly returned objects (anObject and error) be
autoreleased? In other word, if I get an object from any method other than
alloc, etc., no matter how it's returned, it should be autoreleased,
correct?

In all cases that I am aware of, objects that are returned by indirection are autoreleased *unless otherwise documented*.


In the case of the example you cite (getObjectValue:forString:errorDescription:) the docs *don't* say "it is the responsibility of the caller to free/release the returned objects" therefore you can assume that they are autoreleased. And in fact if you look at the example code for such a method you'll see that the returned object and the error are indeed autoreleased.

Cheers,
Greg

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Should objects returned by indirection be autoreleased (From: Eric <email@hidden>)

  • Prev by Date: Re: vertical list of views
  • Next by Date: Re: Converting an HTML source string to a readable string
  • Previous by thread: Re: Should objects returned by indirection be autoreleased
  • Next by thread: Re: Should objects returned by indirection be autoreleased
  • Index(es):
    • Date
    • Thread