Pre-processor symbols

To get access to the tracing, asserts, and reporting facilities in your code, you have to enable the debugging runtime library, and this is done by using the /MDd, /MTd, or /LDd compiler switches, which will define the _DEBUG pre-processor symbol. The _DEBUG pre-processor symbol enables a lot of facilities, and conversely, not defining this symbol will help in optimizing your code.

    #ifdef _DEBUG        cout << "debug build" << endl;     #else        cout << "release built" << endl;     #endif

The C++ compiler will also provide information through some standard pre-processor symbols. Most of these are useful only for library writers, but there are some that you may want to use.

The ANSI standard says that the __cplusplus symbol should ...

Get Beginning C++ Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.