Next: define undef Up: No Title Previous: Redirection

The C Preprocessor

Before your C program is compiled a preprocessing stage occurs. The C preprocessor performs simple macro subsitutions: that is, lexical substitutions. You have already seen the use of, for example, #define, to improve the legibility of a program, but there are other uses too.

We will look at all of the preprocessor key words and what they do, as well as giving some examples of typical use.

All of the preprocessor key words start with # in the lefthand column. Each will cause some lexical change to the C code that is passed to the compiler proper. You can examine the code produced by the preprocessor, before it reaches the compiler proper, with

	cc -E my_file.c | moreG

Preprocessor commands stay in effect until the end of the source file. They may appear anywhere.




Next: define undef Up: No Title Previous: Redirection


maspjw@
Tue Sep 27 15:29:34 BST 1994