• 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: Question about scope of "convenience objects"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about scope of "convenience objects"


  • Subject: Re: Question about scope of "convenience objects"
  • From: "I. Savant" <email@hidden>
  • Date: Fri, 21 Sep 2007 11:30:03 -0400

> So it looks like I am ok after all to use my NSDictionaryObject in
> the method that called the method in which the object was created. Is
> this correct?

  How do you think dictionaries and arrays of things are handed back
to you from other Cocoa methods? A hint: the same way. :-) If you
weren't able to rely on the object being returned sticking around long
enough for you to at least retain it, nothing would work right.

  I see some prefer the style (on a "getter" accessor method) of:

  return [[object retain] autorelease];

  But the memory management guide says simply returning the object is
sufficient: "... no need for retain or release:". Given that, I don't
think that really buys you anything in the general case.

  FWIW, I use the "hand back a dictionary to return multiple values"
approach frequently. It's (IMHO) a natural use of such a "throw-away"
container.

--
I.S.
_______________________________________________

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: Question about scope of "convenience objects"
      • From: Scott Ribe <email@hidden>
References: 
 >Question about scope of "convenience objects" (From: Paul Bruneau <email@hidden>)

  • Prev by Date: Re: Image Batch Processing
  • Next by Date: Re: Image Batch Processing
  • Previous by thread: Re: Question about scope of "convenience objects"
  • Next by thread: Re: Question about scope of "convenience objects"
  • Index(es):
    • Date
    • Thread