You can use this symbol with #if or #ifdef to compile source conditionally. The symbol definition remains in effect until a redefinition is encountered in source or the symbol is undefined in source with the #undef directive.

/D has much the same effect as using the #define directive at the beginning of your source file. However, /D strips quotes on the command line and #define retains them.

By default, the value associated with a symbol will be 1. That is, /DTEST is equivalent to /DTEST=1. In the following example, the definition of TEST is shown to print 1.

Compiling with /Dname= causes the symbol to not have an associated value. While the symbol can still be used to conditionally compile code, the symbol will otherwise evaluate to nothing. For example, in the sample program, compiling with /DTEST= will cause a compiler error. This behavior is similar to using #define with or without a value.