Re: Circular references
Re: Circular references
- Subject: Re: Circular references
- From: "Henry McGilton (Boulevardier)" <email@hidden>
- Date: Sun, 13 Sep 2009 21:13:37 -0700
On Sep 13, 2009, at 4:17 PM, Kyle Sluder wrote:
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.
A potentially much simpler way of handling the job as well as getting
rid of all the
incestuous connections is simply to handle the event processing in the
View Controller.
View Controllers are Responders on both desktop and mobile
platforms . . .
Cheers,
. . . . . . . . Henry
_______________________________________________
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