Compilation Steps
A C++ source file undergoes many transformations on its
way to becoming an executable program. The initial steps involve
processing all the #include and
conditional preprocessing directives to produce what the standard calls
a translation unit. Translation units are important
because they have no dependencies on other files. Nonetheless,
programmers still speak in terms of source files, even if they actually
mean translation units, so this book uses the phrase
source file because it is
familiar to most readers. The term “translation” encompasses compilation
and interpretation, although most C++ translators are compilers. This
section discusses how C++ reads and compiles (translates) source files
(translation units).
A C++ program can be made from many source files, and each file can be compiled separately. Conceptually, the compilation process has several steps (although a compiler can merge or otherwise modify steps if it can do so without affecting the observable results):
Read physical characters from the source file and translate the characters to the source character set (described in Section 1.4 later in this chapter). The source “file” is not necessarily a physical file; an implementation might, for example, retrieve the source from a database. Trigraph sequences are reduced to their equivalent characters (see Section 1.6 later in this chapter). Each native end-of-line character or character sequence is replaced by a newline character.
If a backslash character ...