Ownership regarding to returned Quartz objects

Posted by huggie on Stack Overflow See other posts from Stack Overflow or by huggie
Published on 2010-05-25T04:04:59Z Indexed on 2010/05/25 4:11 UTC
Read the original article Hit count: 223

Filed under:
|

I have recently asked about autoreleasing a returned quartz object: http://stackoverflow.com/questions/2819548/autorelease-for-cgmutablepathref

Dave DeLong answered my question that there is no autorelease for quartz (or any NS foundation objects) and I should use the Create Rule. However the naming convention on the document says,

The Core Foundation naming conventions, in particular use of the word “create”, only apply to C functions that return Core Foundation objects. Naming conventions for Objective-C methods are governed by the Cocoa conventions, irrespective of whether the method returns a Core Foundation or Cocoa object.

By this account since my function is a message in an objective C object it doesn't seem proper to name it createSomething. I still want to return this object. What's the best way to approach this? Should I use the Get Rule and then have the caller explicitly retain it? But this is not within Cocoa convention. What's the proper way to handle this?

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about quartz