liveBook · Manning

Preprocessor

A preprocessor is a source-processing component or stage that transforms input, often handling directives or expansions, before primary processing.

How 3 Manning books explain it

Modern C, Third Edition

The C preprocessor is a translation phase that processes preprocessing directives and expands macros before compilation.

How it is used
Provides textual substitution for reusable expressions, declarations, definitions, and statement-like code, including type-generic programming.
How deep it goes
Explains invocation parsing, recursive argument expansion, parameter substitution, and recursion prevention, but stops short of broader preprocessing directives.
Examples
Uses BYTECOPY and MINSIZE expansions, gray-value color macros, generated color declarations, and a mutex-protected statement macro.
What you can do after
Build type-generic expressions, declarations, definitions, and statement-like macros while tracking textual expansion and argument evaluation.

Read how Modern C, Third Edition explains preprocessor →

100 C++ Mistakes and How to Avoid Them

A preprocessor is a source-processing component that transforms code, including performing macro substitution, before compilation.

How it is used
Warns against depending on macros when writing or maintaining C++ code.
How deep it goes
Explains textual substitution through concrete failures and contrasts macros with typed constants, templates, loops, and bool.
Examples
Uses PI, SQUARE, FOR, TRUE, and FALSE macros alongside corrected C++ equivalents.
What you can do after
Evaluate macro hazards and replace simple macros with typed constants, template functions, explicit loops, and bool values.

Read how 100 C++ Mistakes and How to Avoid Them explains preprocessor →

Modern C

How it is used
Explains how C transforms source text before primary compilation, especially when expanding function-like macros.
How deep it goes
Traces argument parsing, recursive expansion, substitution, and recursion prevention, but stops short of broader preprocessing stages.
Examples
Uses MINSIZE, BYTECOPY, memcpy, and string_literal to demonstrate expansion, substitution, and deliberate macro avoidance.
What you can do after
Evaluate function-like macro expansion by tracing arguments, recursive substitutions, balanced delimiters, and resulting source text.

Read how Modern C explains preprocessor →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.