Pages

Sunday, October 28, 2012

Compilation Unit

Eclipse uses CompilationUnit as the basic unit of programming. A compilation unit is a single file the compiler sees. Your .c file may include other .c files, but after the preprocessor sorting out the includes, the compiler eventually sees just a single "compilation unit". – Eli Bendersky Feb 21 '09 at 7:12

Header files have no separate life, only their content is #included into .c or .cpp files. But since #include is handled by the preprocessor, the compiler has no knowledge about distinct header files; it only sees the resulting code listing as input. This is what is called a compilation unit: a source file with all its #include directives replaced by the content of the relevant header files. - Péter Török

Reference

  1. What does “static” mean in a C program?
  2. How is compilation unit defined in c++?
  3. http://en.wikipedia.org/wiki/Single_Compilation_Unit

No comments:

Post a Comment