The standard predefined versions are documented by the D language specification hosted at https://dlang.org/spec/version.html#predefined-versions.
all
none
Version none
is never defined; used to just disable a section of code.
Version all
is always defined; used as the opposite of none
.
BigEndian
LittleEndian
These versions reflect the byte order of multi-byte data in memory.
LittleEndian
is set when the least significant byte is first.
BigEndian
is set when the most significant byte is first.
CRuntime_Bionic
CRuntime_Glibc
CRuntime_Microsoft
CRuntime_Musl
CRuntime_Newlib
CRuntime_UClibc
These versions reflect which standard C library is being linked in.
CRuntime_Bionic
is set when Bionic is the default C library.
CRuntime_Glibc
is set when GLIBC is the default C library.
CRuntime_Microsoft
is set when MSVCRT is the default C library.
CRuntime_Musl
is set when musl is the default C library.
CRuntime_Newlib
is set when Newlib is the default C library.
CRuntime_UClibc
is set when uClibc is the default C library.
CppRuntime_Gcc
This version is defined when the standard C++ library being linked in is libstdc++.
D_BetterC
This version is defined when the standard D libraries are not being implicitly linked in. This also implies that features of the D language that rely on exceptions, module information, or run-time type information are disabled as well. Enabled by -fno-druntime.
D_Coverage
This version is defined when code coverage analysis instrumentation is being generated. Enabled by -ftest-coverage.
D_Ddoc
This version is defined when Ddoc documentation is being generated. Enabled by -fdoc.
D_Exceptions
This version is defined when exception handling is supported. Disabled by -fno-exceptions.
D_HardFloat
D_SoftFloat
These versions reflect the floating-point ABI in use by the target.
D_HardFloat
is set when the target hardware has a floating-point unit.
D_SoftFloat
is set when the target hardware does not have a
floating-point unit.
D_Invariants
This version is defined when checks are being emitted for class invariants and struct invariants. Enabled by -finvariants.
D_LP64
This version is defined when pointers are 64-bits. Not to be confused with
with C’s __LP64__
model.
D_ModuleInfo
This version is defined when run-time module information (also known as
ModuleInfo
) is supported. Disabled by -fno-moduleinfo.
D_NoBoundsChecks
This version is defined when array bounds checks are disabled. Enabled by -fno-bounds-checks.
D_Optimized
This version is defined in all optimizing compilations.
D_PIC
This version is defined when position-independent code is being generated. Enabled by -fPIC.
D_PIE
This version is defined when position-independent code that can be only linked into executables is being generated. Enabled by -fPIE.
D_PreConditions
This version is defined when checks are being emitted for in
contracts.
Disabled by -fno-preconditions.
D_PostConditions
This version is defined when checks are being emitted for out
contracts.
Disabled by -fno-postconditions.
D_TypeInfo
This version is defined when run-time type information (also known as
TypeInfo
) is supported. Disabled by -fno-rtti.
D_Version2
This version defined when this is a D version 2 compiler.
unittest
This version is defined when the unittest
code is being compiled in.
Enabled by -funittest.