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 <d...@looktowindward.com> 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 (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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to