Re: Protocol-related compilation warnings
Re: Protocol-related compilation warnings
- Subject: Re: Protocol-related compilation warnings
- From: Andrew White <email@hidden>
- Date: Wed, 08 Jun 2005 13:50:20 +1000
I agree with Ondra.
As a general rule, any header file that requires something declared in
another header file should either import that header file or (often better)
have a forward declaration (eg "@protocol Foo;" or "@class Bar;").
Since class Bar conforms to protocol Foo, the compiler needs all the
details of Foo at the point which it attempts to declare Bar. Thus, you
need to #import "p.h" into "q.h".
It's really irritating to tell the user that they must include/import
another header file before the header file in question for things to work
correctly. This is doubly true with "#import", which allows the compiler
to do all the duplicate header supression for you. If I include your
header, I expect any classes declared in your header to work without
needing other headers.
--
Andrew White
--------------------------------------------------------------------------
This email and any attachments may be confidential. They may contain legally
privileged information or copyright material. You should not read, copy,
use or disclose them without authorisation. If you are not an intended
recipient, please contact us at once by return email and then delete both
messages. We do not accept liability in connection with computer virus,
data corruption, delay, interruption, unauthorised access or unauthorised
amendment. This notice should not be removed.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden