Basic concepts | ||||
Keywords | ||||
Preprocessor | ||||
Statements | ||||
Expressions | ||||
Initialization | ||||
Declarations | ||||
Functions | ||||
Miscellaneous | ||||
History of C | ||||
Technical Specifications |
The preprocessor is executed attranslation phase 4, before the compilation. The result of preprocessing is a single file which is then passed to the actual compiler.
Contents |
The preprocessing directives control the behavior of the preprocessor. Each directive occupies one line and has the following format:
#
characterdefine
,undef
,include
,if
,ifdef
,ifndef
,else
,elif
,elifdef
,elifndef
(since C23),endif
,line
,embed
(since C23),error
,warning
(since C23),pragma
)[1]The null directive (#
followed by a line break) is allowed and has no effect.
The preprocessor has the source file translation capabilities:
#if
,#ifdef
,#ifndef
,#else
,#elif
,#elifdef
,#elifndef
(since C23) and#endif
).#define
and#undef
, and operators#
and##
)#include
and checked with__has_include
(since C23))#error
or#warning
respectively(since C23))The following aspects of the preprocessor can be controlled:
#pragma
and operator_Pragma
(since C99))#line
)This section is incomplete Reason: no example |
C documentation forPredefined Macro Symbols | |
C documentation forMacro Symbol Index | |
C++ documentation forPreprocessor |