The C preprocessor makes it possible to conditionally compile certain blocks of code using
#define and related directives. Once again, D achieves similar results using built-in compile-time statements, such as
version condition is used to instruct the compiler to generate code for anything in the
version block only if the specific condition is defined. Here's an example:
version(Windows) pragma(msg, "We are compiling on Windows."); else version(OSX) pragma(msg, "We are compiling on a Mac OS X system."); else version(Posix) pragma(msg, "We are compiling on a Posix system.");
This example uses the predefined versions
Posix. Swap the order of the
Posix and ...