Jump to content

C++ Language/Preprocessing/ConditionalCompilation

From Wikibooks, open books for an open world

The traditional way to conditionally-compile code was to use #ifdef or #if. But the preprocessor cannot reason about types, so modern code sometimes uses if constexpr instead.

Additional information about conditional-compilation (includes interactive examples)