Re: Where/when to #import
Re: Where/when to #import
- Subject: Re: Where/when to #import
- From: tiennou <email@hidden>
- Date: Tue, 9 Oct 2007 16:15:24 +0200
Le 9 oct. 07 à 15:41, Nelson Santos a écrit :
Hi Paul,
Here are the rules that I follow which seems to work very well for me:
(1) #import <Cocoa/Cocoa.h goes in your class's .h file.
(2) Use @class only in your .h files for all of your class
references used (unless you derived your class from another class,
in which you need to use the #import directive, because the
compiler needs to know everything about the original class when you
derive.)
(3) Place all other #import directives in your .m files.
I'm using this too, because I was stung with a cross-reference one
time and discovered I was doing wrong (I was #import'ing everything
in *.h files)... Another little addition, if you're building a
framework :
It's better to use #import <framework/file.h> syntax in your public
API headers, so that someone including your framework don't need to
add an unnecessary include path to their project... (I had problem
with this in the past, but I can't remember how...)
Etienne Samson_______________________________________________
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