InterviewSolution
| 1. |
What Do You Mean By Translation Unit In C++? |
|
Answer» We organize our C++ PROGRAMS into different source files (.cpp, .cxx etc). When you consider a source file, at the preprocessing stage, some extra content may get added to the source code ( for example, the contents of HEADER files included) and some content may get removed ( for example, the part of the code in the #ifdef of #ifndef block which resolve to false/0 based on the symbols defined). This effective content is called a translation unit. In other words, a translation unit consists of Contents of source file Plus contents of files included DIRECTLY or indirectly Minus source code lines ignored by any CONDITIONAL pre processing DIRECTIVES ( the lines ignored by #ifdef,#ifndef etc) We organize our C++ programs into different source files (.cpp, .cxx etc). When you consider a source file, at the preprocessing stage, some extra content may get added to the source code ( for example, the contents of header files included) and some content may get removed ( for example, the part of the code in the #ifdef of #ifndef block which resolve to false/0 based on the symbols defined). This effective content is called a translation unit. In other words, a translation unit consists of Contents of source file Plus contents of files included directly or indirectly Minus source code lines ignored by any conditional pre processing directives ( the lines ignored by #ifdef,#ifndef etc) |
|