The C preprocessor, generally called cpp,
transforms your code before passes it to the C compiler.
| The C preprocessor | ||
|---|---|---|
| Removes most comments, but adds a few giving the name of files and line numbers within files. The C compiler uses these when generating error messages. | Before | After |
| Allows the splitting of long lines. | Before | After |
| Substitutes for trigraphs if you ask. | Before | After |
| Allows the definition of manifest constants. | Before | After |
| Allows the use of macros. | Before | After |
| Allows the use of useful macros, if you add in enough parentheses. | Before | After |
| Stringizes. | Before | After |
| Glues. | Before | After |
| Reads your include files. | Before | After |
| Reads the standard include files. | Before | After |
| "Branches" according to what is defined are by values of constants. | Before | After |
Has a common technique, wrapper #ifndef or
#include guard, or macro guard ,
for avoiding multiple inclusion
of include files.
|
Before | After |
| Allows complicated tests on integers for branches. | Before | After |
| Has some preloaded macros specified by ANSI C standard. | Before | After |
| Can stop compilation when something is wrong. | For example | |
| Can define complex statements, if you work at in | Before | After |
| Makes C++ happy to use your C | For example | |
| Allows a variable number of arguments in C99 | Before | After |
Knows about the #pragma, as in
Open MP
|
For example | |
| Allows instructors to figure out the answers | Before | After |