Re: understanding conversions between CF and NS datatypes
Re: understanding conversions between CF and NS datatypes
- Subject: Re: understanding conversions between CF and NS datatypes
- From: "Michael Ash" <email@hidden>
- Date: Fri, 29 Aug 2008 23:22:38 -0400
On Fri, Aug 29, 2008 at 1:38 PM, Allen Curtis <email@hidden> wrote:
> 1. Where can I get a better understanding of the data conversion between
> these different frameworks?
> 2. Ultimately the device path names will appear in a ComboBox. Was it
> necessary to convert the CFMutableArray to a NSMutableArray for the
> datasource function?
Ultimately the most important thing to understand about toll-free
bridging (the link between CF and NS data types) is that you don't
have to convert anything. You *can't* convert anything. Because they
aren't two different things. An NSArray *is* a CFArray. An
NSMutableArray is a CFMutableArray. They are just two different names
for the same type.
It gets slightly tricky because the compiler doesn't know this crucial
fact. So when you have a CFMutableArrayRef and you try to treat it
like it was an NSMutableArray*, the compiler gets complainey. So you
have to do some fancy typecasting to shut it up. But it's very
important to understand that this typecast doesn't do any sort of
conversion or translation or anything of the sort, it just tells the
compiler to look at the exact same pointer to the exact same object in
a new light.
Mike
_______________________________________________
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