• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Where to include header files - relates to last question on variable scope
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Where to include header files - relates to last question on variable scope


  • Subject: Re: Where to include header files - relates to last question on variable scope
  • From: "M. Uli Kusterer" <email@hidden>
  • Date: Thu, 4 Nov 2004 23:46:44 +0100

At 23:25 Uhr +0100 31.10.2004, Ole Voß wrote:
Yes, that does sound feasible but I would still have to re-include this header file in every class that I use it in?

YES. He said it about three times now.

I'm just spoilt because I've been programming Perl for over five years now and that language just does everything for you ;-)

I doubt it. IIRC Perl just defers the decision about whether to fail to runtime, while C and Co. decide it at compile time. The advantage of the former approach is that in a few cases a class has been loaded at runtime and it works. The advantage of the latter is that it's less likely to bomb in the face of the user because your mistakes were already noticed at compile time.


If I include my module once - it just stays available to all my other modules and I don't have to re-include it.

If you have all your code in one file, yes. But even in Perl, if you have several 'compilation units' (i.e. several files) you can't just assume Perl will drag the stuff together. If you want the same behavior as Perl, you can do that as well:


Don't add your files to the project file, instead, create one main.m file that includes all other .m and .h files once, in the right order. Then it'll behave just like Perl does.

C is too far away to even remember...

Then you'd better start remembering it now, because the language you're using right now is called Objective *C* for a reason...


 Sorry, it's late, I'm tired.
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
       "The Witnesses of TeachText are everywhere..."
                   http://www.zathras.de
_______________________________________________
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


  • Prev by Date: Re: Creating keyboard equivalents for NSScrollView?
  • Next by Date: Re: Meaning of NSFont italicAngle?
  • Previous by thread: Can not call matOpen()
  • Next by thread: how to get the iTunes look
  • Index(es):
    • Date
    • Thread