• 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: Simple question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simple question


  • Subject: Re: Simple question
  • From: Scott Thompson <email@hidden>
  • Date: Mon, 17 Mar 2008 08:33:31 -0500


On Mar 17, 2008, at 7:53 AM, Luca Ciciriello wrote:


Yes, you got it. .h stands for "header" and is the place where you make your declarations, .m stands for "module" and is where the definitions take place.


You can encounter also .mm exetension. In these file you can mix Objective-C an C++ language.

I would recommend that you find a nice book on C. I would recommend one, but it's been a while since I've surveyed the literature.


The C derived languages (with those most relevant to Macintosh programming being, C, C++, Objective-C, and Objective-C++) tend to separate your code into two parts. The first is the active part of your program, that part which "does things". This code is placed into a file whose extension depends on the language you are using. As Luca points out ".c" is for C source code. ".m" is for Objective-C source code. C++ source is usually found in a file ending either in ".cp" or ".cpp". And Objective-C++ code uses ".mm".

The header, or ".h" file doesn't typically contain active code. Instead, it usually contains some kind of description of the code that is found in the corresponding source code file. The description lets other part of your program know what functionality can be found in the source code file.

To sum up, the source code file defines what your program can do, and how it can do it. The header file declares what's available and you you invoke it.

Scott

_______________________________________________

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


  • Follow-Ups:
    • Re: Simple question
      • From: "Kyle Sluder" <email@hidden>
    • Re: Simple question
      • From: Rob Keniger <email@hidden>
References: 
 >Simple question (From: Cocoa <email@hidden>)
 >RE: Simple question (From: Luca Ciciriello <email@hidden>)

  • Prev by Date: strange "lockFocus sent to a view whose window is deferred" error with an NSOutlineView on Tiger
  • Next by Date: Re: Simple question
  • Previous by thread: RE: Simple question
  • Next by thread: Re: Simple question
  • Index(es):
    • Date
    • Thread