C++: The Complete Reference
defined--only offset information has been kept. When your program links with the
functions in the standard library, these memory offsets are used to create the actual
addresses used. There are several technical manuals and books that explain this
process in more detail. However, you do not need any further explanation of the
relocation process to program in C++.
will use again and again, you can place it into a library, too.
program's length grows, so does its compile time (and long compile times make for
short tempers). Hence, C/C++ allows a program to be contained in many files and lets
you compile each file separately. Once you have compiled all files, they are linked,
along with any library routines, to form the complete object code. The advantage of
separate compilation is that if you change the code of one file, you do not need to
recompile the entire program. On all but the simplest projects, this saves a substantial
amount of time. The user documentation to your C/C++ compiler will contain
instructions for compiling multifile programs.
compiled using any modern C++ compiler. They are also valid C programs and can be
compiled using a C compiler. Thus, if you are called upon to write C programs, the
ones shown in Part One qualify as examples. Traditionally, C programs use the file
extension .C, and C++ programs use the extension .CPP. A C++ compiler uses the file
extension to determine what type of program it is compiling. This is important because
the compiler assumes that any program using the .C extension is a C program and that
any file using .CPP is a C++ program. Unless explicitly noted otherwise, you may use
either extension for the programs in Part One. However, the programs in the rest of
this book will require .CPP.
as a C program (using the .C extension). Any instances of this will be noted.