Re: ARC + return of autoreleased CFType
Re: ARC + return of autoreleased CFType
- Subject: Re: ARC + return of autoreleased CFType
- From: Charles Srstka <email@hidden>
- Date: Thu, 20 Oct 2011 16:05:30 -0500
On Oct 20, 2011, at 3:43 PM, Matt Neuburg wrote:
>
> On Oct 20, 2011, at 1:20 PM, Greg Parker wrote:
>
>> On Oct 20, 2011, at 10:11 AM, Matt Neuburg wrote:
>>> You know there's a rule that Create means a retained ref is returned
>>
>> There is no such rule in the Cocoa memory management conventions.
>>
>> http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmRules.html
>>
>> There is a "Create" rule in the convention for CoreFoundation functions, but that convention does not apply to Objective-C methods.
>
> Sure, but still, he's returning a retained CGColorRef. And CGColor participates in this convention (CGColorRelease, CGColorRetain, CGColorCreate etc.). I'm not saying he has to do it; I'm merely suggesting that the magic word "Create" will help him remember what he's trying to remember, namely that he's returning a retained CGColorRef and the caller will need to call CGColorRelease on it later. m._______________________________________________
Yeah, but CGColorRelease, etc. are functions. He’s writing an Objective-C method, where the conventions are different.
Myself, I’d prefix that method’s name with “new”, but that’s me.
Charles_______________________________________________
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