Utilities¶
-
CORE_PP_EMPTY()¶
Expands to nothing.
-
CORE_PP_COMMA()¶
Expands to a literal comma character
-
CORE_PP_LPAREN()¶
Expands to a literal left parenthesis character.
-
CORE_PP_RPAREN()¶
Expands to a literal right parenthesis character.
-
CORE_PP_PASS(...)¶
Expands to the zero-or-more passed arguments.
-
CORE_PP_HAS_ARGS(...)¶
Expands to 1 if the macro is passed arguments, 0 otherwise.
CORE_PP_HAS_ARGS() // 0 CORE_PP_HAS_ARGS(a) // 1 CORE_PP_HAS_ARGS(a,b) // 1 CORE_PP_HAS_ARGS((a,b)) // 1
-
CORE_PP_STRINGIZE(...)¶
-
CORE_PP_UNPAREN(...)¶
Expands to its arguments removing a pair of enclosing parentheses if possible.
Invoking this macro on a sequence produces a list.
CORE_PP_UNPAREN(a) // a CORE_PP_UNPAREN((a)) // a CORE_PP_UNPAREN((a,b)) // a,b
-
CORE_PP_EVAL(...)¶
Force the preprocessor to recursively expand the given arguments.
Left to its own devices, the preprocessor will not recursively expand macros, but will do a single-pass substitution.
CORE_PP_EVAL
recursivley expands its arguments up to 1024 levels.#define A(x) x+1 #define EMPTY #define NEEDS_TWO_PASSES(x) A EMPTY (x) NEEDS_TWO_PASSES(2) // A (2) CORE_PP_EVAL(NEEDS_TWO_PASSES(2)) // 2 +1
-
CORE_PP_DEFER1(id)¶
Defers the expansion of its argument for a single pass.
-
CORE_PP_DEFER2(id)¶
Defers the expansion of its argument for two passes.
-
CORE_PP_DEFER3(id)¶
Defers the expansion of its argument for three passes.
-
CORE_PP_DEFER4(id)¶
Defers the expansion of its argument for four substitution passes.