Re: Circular references
Re: Circular references
- Subject: Re: Circular references
- From: Kyle Sluder <email@hidden>
- Date: Sun, 13 Sep 2009 16:17:56 -0700
We already know the cause and the solution: MyViewController.h imports
MySubview.h, and MySubview.h imports MyViewController.h. The standard
C header preprocessor trick does not help in this situation, and
neither does import.
The solution is to use a forward declaration. For ObjC classes this
looks like "@class Foo;". For functions it's a prototype delcaration:
"int foo();". Structs are similar: "struct foo;", and C++ classes
follow suit: "class Foo;".
In short, this is a well-known consequence of C requiring types to be
defined before they're used.
--Kyle Sluder
On Sep 13, 2009, at 3:56 PM, Jay Reynolds Freeman <email@hidden
> wrote:
Unfortunately, "#import" seems not to be working in the case given;
I don't know why. The mechanism I suggested might be useful for
chasing down why.
-- Jay Reynolds Freeman
---------------------
email@hidden
http://web.mac.com/jay_reynolds_freeman (personal web site)
On Sep 13, 2009, at 3:41 PM, Kyle Sluder wrote:
This does not solve the problem at hand (two interfaces need a
declaration of each other's symbols). The mechanism you describe is
obsoleted by #import.
_______________________________________________
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