What is Preprocessor ?

What is Preprocessor and How it Works ?

Preprocessor  Primer ( .pdf )

Preprocessor Primer

What is Preprocessor and How it Works ?

Preprocessor Primer ( .pdf )

Pre-processor

What is Pre-processor and how it works ?

The Pre-processor is a translation program that prepares source code for compilation by  applying pre-defined text replacements. The replacements to be made are specified by  directives in the source file. The preprocessor operates transparently as a part of the  compilation process.

First phase of of compilation process is pre-processing. The portion of compile engine  that perform pre-processing phase is called pre-processor.

Before the later compilation  phases take place, pre-processor scan the source file from top to bottom for certain  directives and translate them into regular source code that can be compiled. The output of  the pre-processor is then used as input to the next step of compilation. The /P compiler  option can be used to write this pre-processor output (.ppo) file to disk so that you can  see the source code that was used as input to the next compilation phase. This option  is especially useful if you have used the #command and #translate directives to build  user-defined commands. You can look at the (.ppo) file to see whether or not commands  translated as you expected.

The following table summarize the pre-processor directives.

Directive              Meaning
--------------------   --------------------------------------------------------------
#define                Define a manifest constant or pseudo-function
#undef                 Remove a #define definition

#include               Include a file into the current source file

#command, #xcommand,   Specify a user defined command or translation 
#translate,            directive (This four directives are same as each
#xtranslate            others with some minor differences) . 

#ifdef                 Compile a section of code if an identifier is defined
#ifndef                Compile a section of code if an identifier is undefined

#error                 Generate a compiler error and display a message
#stdout                Send literal text to the standard output device

Here you can find pre-processor terms.