|
From: | Paul Johnson |
Subject: | Re: [Swarm-Support] When did gcc get so lenient about the location of variable declarations? |
Date: | Mon, 14 Mar 2005 23:15:59 -0600 |
User-agent: | Mozilla Thunderbird 0.9 (X11/20041127) |
Bill Northcott wrote:
On 15/03/2005, at 4:13 AM, Paul Johnson wrote:I need help with one piece of syntax. Recall you can tell the compiler that a class exists, although it has not been presented yet, with the directive@class TheClassNameIF you do that, then you can use (TheClassName *) as a return type and the compiler does not bother you.What is the equivalent declaration for a protocol?From the Objective-C language manual syntax definitions: protocol-declaration: @protocol protocol-name [ protocol-reference-list ] [ interface-declaration-list ] @end protocol-declaration-list: @protocol < protocol-list > ; class-declaration-list: @class class-list ; Which is hopefully self-explanatory. So I guess you need: @protocol < SomeProtocol SomeOtherProtocol >;
I got inspired and tried that. Here's the compiler error:In file included from /home/pauljohn/LinuxDownloads/redhat/BUILD/swarm-2.2/src/defobj/../defobj/DefObject.h:27, from /home/pauljohn/LinuxDownloads/redhat/BUILD/swarm-2.2/src/defobj/../defobj/Customize.h:27, from /home/pauljohn/LinuxDownloads/redhat/BUILD/swarm-2.2/src/defobj/../defobj/Create.h:26, from /home/pauljohn/LinuxDownloads/redhat/BUILD/swarm-2.2/src/defobj/../defobj/Archiver.h:20, from /home/pauljohn/LinuxDownloads/redhat/BUILD/swarm-2.2/src/defobj/Archiver.m:20: /home/pauljohn/LinuxDownloads/redhat/BUILD/swarm-2.2/src/defobj/defobj.h:85: error: syntax error before '<' token In file included from /home/pauljohn/LinuxDownloads/redhat/BUILD/swarm-2.2/src/defobj/defobj.h:1431, from /home/pauljohn/LinuxDownloads/redhat/BUILD/swarm-2.2/src/defobj/../defobj/DefObject.h:27, from /home/pauljohn/LinuxDownloads/redhat/BUILD/swarm-2.2/src/defobj/../defobj/Customize.h:27, from /home/pauljohn/LinuxDownloads/redhat/BUILD/swarm-2.2/src/defobj/../defobj/Create.h:26, from /home/pauljohn/LinuxDownloads/redhat/BUILD/swarm-2.2/src/defobj/../defobj/Archiver.h:20, from /home/pauljohn/LinuxDownloads/redhat/BUILD/swarm-2.2/src/defobj/Archiver.m:20:
So I tried with cutting out the <> brackets, @protocol SomeOtherProtocol ;and the error then changes to reject the eventual full declaration of the SomeOtherProtocol because it had already had a protocol declaration.
-- Paul E. Johnson email: address@hidden Dept. of Political Science http://lark.cc.ku.edu/~pauljohn 1541 Lilac Lane, Rm 504 University of Kansas Office: (785) 864-9086 Lawrence, Kansas 66044-3177 FAX: (785) 864-5700
[Prev in Thread] | Current Thread | [Next in Thread] |