|
|
The organization of the C++ compilation system is similar to that of the C compilation system. It consists of a preprocessor, compiler, assembler and link editor. In fact, the code generation portion of the compiler, the assembler and link editor are those used in a C compilation. There is also a C++ name filter (demangler) and a C++ prelink phase. The CC command invokes each of these components automatically, unless otherwise directed, to create an executable C++ program from the source code.
The C++ preprocessor performs the same function as the C preprocessor. See ``C preprocessor'' for details.
Like the C compiler, the C++ compiler proper translates the C++ language code in your source files, which now contain the preprocessed contents of any included header files, into assembly language code. The compiler does not use C language as an intermediate form.
The C++ assembler is the same as that used for C, and performs the same functions for your C++ program. See ``C assembler'' for details.
The C++ prelinker is a "linker feedback" mechanism which supports user-requested automatic template instantiation. The CC command invokes the prelinker once a complete set of object files has been generated to determine whether any new instantiations are required or if any existing instantiations are no longer needed. Recompilation of source files is done as needed to generate any required instantiation. See ``Instantiating C++ templates'' for an explanation of how C++ templates are instantiated.
The C++ linker is the same as that used for C, and performs the same functions for your C++ program. See ``C linker''
To support C++ operator functions and overloaded functions, enable type-safe linkage, implement namespaces, provide unique function names for the link editor, and so on, the C++ compiler encodes many of the names it uses. These encoded names can be quite cryptic.
The c++filt demangling name filter is used by the CC command to display diagnostics from the code generator, prelinker and linker in a format corresponding to the declaration or definition in your C++ source program. In addition, c++filt(C++) is available to decode output of other utilities that may work with C++ object files or libraries.
``Organization of C++ Compilation System'' shows the organization of the C compilation system. Details concerning the optimizer are omitted here because it is optional. See ``Commonly used command line options'' for more information concerning invoking the optimizer.
Organization of C++ Compilation System