Πέμπτη, 22 Μαρτίου 2012

#include vs #import and Preprocessor directives

#include and #import request that the preprocessor* read a file and add it to its output.
The difference between #include and #import is that

  • #include  allow you to include the same file many times. 
  • #import ensures that the preprocessor only includes a file once. 
C programmers tend to use #include. 
Objective-C programmers tend to user #import. 

* Compiling a file in Objective-C is done in two passes. First, the preprocessor runs through the file. The output from the preprocessor goes into the real compiler. 
Preprocessor directives start with #. The three most popular are 
  • #include
  • #import
  • #define

Δεν υπάρχουν σχόλια:

Δημοσίευση σχολίου