Re: Compiles everything
Re: Compiles everything
- Subject: Re: Compiles everything
- From: Wade Tregaskis <email@hidden>
- Date: Fri, 19 Nov 2004 14:07:55 +1100
As a simple rule of thumb, in my header files I only #import the
header for the superclass of the class I'm defining, or classes that
I'm extending with a category.
For all other classes - those used in arguments and return values,
static variables, structure elements, etc. - I declare them with
@class in my headers, and only use #import in the .m files that need
the full declarations to resolve method calls.
This is an interesting concept which I myself only picked up on a few
months ago, that of including non-interface headers in the
implementation file. Nearly every introductory book or article you
read on C/C++/ObjC always places everything in the headers by default,
which is valid if only really stupid, in terms of compiling
performance.
Personally I avoid using @class pre-declarations, as they tend to just
catch you out when you later do need the actual header, such as if you
use another type or constant from it, associated with that class. But
not so much to disagree, as to reiterate & reinforce what Mr. Pendley
has said to all those other people out there who hadn't made this
trivial yet apparently (imho, anyway) subtle observation yet.
Wade Tregaskis (AIM, Yahoo & Skype: wadetregaskis, ICQ: 40056898, MSN &
email: email@hidden, Jabber:
email@hidden)
-- Sed quis custodiet ipsos custodes?
_______________________________________________
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