WARNING: This server is unstable and will be retired in the next days.
If you want to keep this forum available, please request immediately a migration
on the Nabble Support forum.
Forums that don't receive any migration request will be deleted forever.
David Chisnal wrote: On 14 Oct 2009, at 00:30, Jean-Loïc Mauduy wrote:
This is wrong. A few Objective-C tutorials make this mistake, and tell
you to just use #import instead of #include in Objective-C programs,
but this is terrible advice. #include is a trivial preprocessor
directive that just inserts the contents of the specified file at this
point. #import is a bit more clever, and ensures that the file is only
ever inserted once.
Objective-C headers are, generally, designed to be used with #import.
A lot of C (and C++) headers, however, are not. They will protect
themselves from multiple inclusion with macros and may be designed to
work differently if included more than once in a compilation unit. If
you get into the habit of using #import with C headers, then you are
going to end up with something breaking eventually, and you are going
to be very confused about why. Only use #import with Objective-C
headers; stick with #include for C headers. This also provides a clue
to people reading your code about what kind of header you are including.