Re: NEWBIE: NSArray toll-free-bridged with CFArray?
Re: NEWBIE: NSArray toll-free-bridged with CFArray?
- Subject: Re: NEWBIE: NSArray toll-free-bridged with CFArray?
- From: Mike Shields <email@hidden>
- Date: Sat, 7 Sep 2002 22:01:54 -0600
On Saturday, September 7, 2002, at 06:25 PM, ber wrote:
Thanks Andreas,
I'm assuming at this point even if things are 'toll-free-bridged' one
can expect
the compiler to still complain.
brian
Yes, NSArray and CFArray are toll-free bridged, but that's an
implementation detail. There's no method for the _compiler_ to
determine that a CFArray == an NSArray, so you have to typecast. Here's
an example to illustrate what I mean.
typedef struct _Foo
{
char a;
char b;
char c;
char d;
} Foo;
typedef struct _Bar
{
char a;
char b;
char c;
char d;
} Bar;
These two structs are identical and in my little fantasy world they
contain the same information and mean the same things semantically. But
from the compiler's point of view, they have no relation to each other
so if I wanted to do this:
Foo* aFooPtr;
Bar aBar;
aFooPtr = &aBar;
The compiler would complain since I'm trying to assign a pointer of one
type to a pointer of another type. This is the same thing that's going
on with NSArray and CFArray.
Hope this clears every thing up for you.
Mike
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.