Table of Contents
Preprocessor commands used to control what gets compiled and how. They can be used to choose to compile one block of code rather than another for cross-platform compatibility, include headers or other source files, define small inline functions called macros, or alter how the compiler handles variables.
There are four categories of preprocessor commands:
- Conditional Compilation
Commands that allow for branches in compilation based on conditions.
- Text Replacement
Commands that create text-replacement macros.
- File Directives
Commands that indicate to the compiler how other files relate to the source file.
- Control Directives
Commands that set compile options, control compilation, and report compile time information.
Compiles the following code block based on a condition.
Compiles the following code block if a symbol is defined.
Compiles the following code block if a symbol is not defined.
Compiles the following code block if a condition is true and the previous conditions was false.
Compiles the following code block if previous conditions were false.
Signifies the end of a code block.
Returns “-1” if a symbol is defined, otherwise “0”.
Creates a single-line text-replacement macro.
Creates a multi-line text-replacement macro.
Undefines a symbol.
- Preprocessor Stringize
Converts text into a string literal.
- Preprocessor Concatenate
Concatenates two pieces of text.
- Escaped String Literal
Indicates string literal immediately following must be processed for escape sequences.
- Non-Escaped String Literal
Indicates string literal immediately following must not be processed for escape sequences.