Re: Guidelines for Cocoa frameworks supporting garbage collection?
Re: Guidelines for Cocoa frameworks supporting garbage collection?
- Subject: Re: Guidelines for Cocoa frameworks supporting garbage collection?
- From: Jean-Daniel Dupas <email@hidden>
- Date: Sun, 6 Jul 2008 15:49:03 +0200
Le 6 juil. 08 à 14:45, Bill Cheeseman a écrit :
on 2008-07-06 2:45 AM, Quincey Morris at email@hidden
wrote:
It also occurs to me that the OP is going to have to be careful to
document the behavior of methods in *his* framework that return new
CF
objects (if there are any). He'll have to decide whether to use CF
rules (retain count == 1), Cocoa rules (retain count == 1 or
autoreleased object, depending on whether the caller or the framework
is regarded as the owner of the new object), or to return an object
on
which CFMakeCollectable has already been called.
Actually, I (the OP) am receiving inconsistent advice privately
regarding
the original question (the OQ?), namely, whether to use the __strong
keyword
when declaring an instance variable with a CFType-derived type.
Privately, I
have been told by a knowledgeable developer that I do NOT need to use
__strong, if I have been careful in my framework to balance my calls
to
CFRetain and CFRelease. He even goes so far as to suggest that it
would be
dangerous or at least inefficient to use __strong in a mixed
environment
such as a shared framework that supports both garbage collection and
retain/release, due in part to the additional overhead.
If __strong is so dangerous, why is it used in Cocoa (see NSDrawer,
NSDateFormatter, NSNumberFormatter, NSKeyedArchiver, NSURL, …) ?
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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