On Sep 22, 2013, at 10:59 AM, Ed Wynne <ar...@phasic.com> wrote:

>>> On Sep 22, 2013, at 5:07 AM, Graham Cox <graham....@bigpond.com> wrote:
>>> Not if there is a specific retain/release function such as CGImageRetain, 
>>> CGImageRelease. These ignore nil. You should always use these instead of a 
>>> generic CFRelease because they may do additional work for all we know.
> 
> No, these functions exist for purely philosophical reasons. If CG objects are 
> CF objects they should never be used in practice and should be deprecated.

You're both wrong. CGImageRelease is documented to be functionally equivalent 
to CFRelease, except for the non-NULL requirement.

The reason you can call CGImageRelease with a NULL argument is simply because 
it doesn't do any dispatch. CFRelease dispatches through the vtable of the 
object you hand it without checking for NULL.

I prefer to call the more specific release if I know the type of the thing I'm 
releasing.

--Kyle Sluder
_______________________________________________

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