• 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: Objective-C Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Objective-C Question


  • Subject: Re: Objective-C Question
  • From: Dave <email@hidden>
  • Date: Wed, 13 Mar 2013 10:18:00 +0000


On 13 Mar 2013, at 09:24, Markus Spoettl wrote:

On 3/13/13 9:36 AM, Dave wrote:

On 12 Mar 2013, at 21:34, Graham Cox wrote:


On 13/03/2013, at 6:53 AM, Dave <email@hidden> wrote:

If that is the case, then how do you signal to the compiler/ analyzer that you
are returning a retained object?

In general you shouldn't return a retained object (unless it's temporarily
retained and will be autoreleased of course)

Why? Where does it say this?

https://developer.apple.com/library/mac/#documentation/Cocoa/ Conceptual/MemoryMgmt/Articles/mmRules.html

I've looked at this, it doesn't say anything about it - where exactly are you looking?

What I did see:

You own any object you create
You create an object using a method whose name begins with “alloc”, “new”, “copy”, or “mutableCopy” (for example, alloc, newObject, or mutableCopy).

So, newDict as a name to return a retained object is fine, at least I can't see anywhere it says it isn't!

Besides all this, it just plain makes sense to (to me and many others) do it this way. It keeps everything sweet, the Analyser works fine, no lurking autorelease issues and much less fear that you will over or under release the object in question.

All the Best
Dave


_______________________________________________

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


References: 
 >Objective-C Question (From: Dave <email@hidden>)
 >Re: Objective-C Question (From: Mike Abdullah <email@hidden>)
 >Re: Objective-C Question (From: Dave <email@hidden>)
 >Re: Objective-C Question (From: John McCall <email@hidden>)
 >Re: Objective-C Question (From: Dave <email@hidden>)
 >Re: Objective-C Question (From: John McCall <email@hidden>)
 >Re: Objective-C Question (From: Dave <email@hidden>)
 >Re: Objective-C Question (From: John McCall <email@hidden>)
 >Re: Objective-C Question (From: Jens Alfke <email@hidden>)
 >Re: Objective-C Question (From: Dave <email@hidden>)
 >Re: Objective-C Question (From: Jean-Daniel Dupas <email@hidden>)
 >Re: Objective-C Question (From: Dave <email@hidden>)
 >Re: Objective-C Question (From: Graham Cox <email@hidden>)
 >Re: Objective-C Question (From: Dave <email@hidden>)
 >Re: Objective-C Question (From: Markus Spoettl <email@hidden>)

  • Prev by Date: Re: Typesetter - Fragment Generation
  • Next by Date: Re: Another Gnarly Objective-C Question!
  • Previous by thread: Re: Objective-C Question
  • Next by thread: Re: Objective-C Question
  • Index(es):
    • Date
    • Thread