D. Preprocessor

Objectives

In this appendix you'll learn:

  • To use #include for developing large programs.

  • To use #define to create macros and macros with arguments.

  • To understand conditional compilation.

  • To display error messages during conditional compilation.

  • To use assertions to test if the values of expressions are correct.

Hold thou the good; define it well.

Alfred, Lord Tennyson

I have found you an argument; but I am not obliged to find you an understanding.

Samuel Johnson

A good symbol is the best argument, and is a missionary to persuade thousands.

Ralph Waldo Emerson

Conditions are fundamentally sound.

Herbert Hoover [December 1929]

The partisan, when he is engaged in a dispute, cares nothing about the rights of the question, but is anxious only to convince his hearers of his own assertions.

Plato

Outline

D.1 Introduction
D.2 The #include Preprocessor Directive
D.3 The #define Preprocessor Directive: Symbolic Constants
D.4 The #define Preprocessor Directive: Macros
D.5 Conditional Compilation
D.6 The #error and #pragma Preprocessor Directives
D.7 Operators # and ##
D.8 Predefined Symbolic Constants
D.9 Assertions
D.10 Wrap-Up