Re: [Leopard] Debugging GC
Re: [Leopard] Debugging GC
- Subject: Re: [Leopard] Debugging GC
- From: mmalc crawford <email@hidden>
- Date: Mon, 29 Oct 2007 17:33:16 -0700
On Oct 29, 2007, at 5:10 PM, Chris Hanson wrote:
So what is the correct idiom now?
The correct idiom is now (following my own style, sorry):
- (id)somethingFromCarbon {
CFFooReference foo = CFCopyFooWithBar(5);
return [NSMakeCollectable(foo) autorelease];
}
Since a couple of people have said the same thing now, I think it may
be worth pointing out that they're looking at this from the
perspective of a framework developer who has to write mixed-mode code
(code that has to support both managed memory and garbage collected
environments).
For application developers, I'll reiterate Bill's earlier comments:
Choose either GC or non-GC and stick with your choice. The
implementation of your somethingFromCarbon method would then look like:
- (id)somethingFromCarbon {
CFFooReference foo = CFCopyFooWithBar(5);
return NSMakeCollectable(foo);
}
(NSMakeCollectable takes a CFTypeRef as a parameter.)
mmalc
_______________________________________________
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