Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Visual C++ define

Microsoft's Visual C++ compiler, abbreviated VC++, is a very popular compiler but does not implement the standard C++ preprocessor correctly in a number of respects in its default preprocessor. Because of this the programmer using the VMD needs to occasionally do things differently when VC++ is being used. These "quirks" of VC++ have been smoothed over as much as possible in the VMD library, but are mentioned in further topics and occasionally must be addressed by the programmer using VMD.

The VMD has a macro that indicates when the VC++ default preprocessor is being used. The macro is an object-like macro called BOOST_VMD_MSVC. It is set to 1 when VC++'s default preprocessor is being used and set to 0 when VC++'s default preprocessore is not being used. You can use this macro in your own macro code whenever you include a VMD header file to write code which may need special processing for VC++ as outlined in this documentation. Your macro processing may therefore occasional take the form of:

#include <boost/vmd/some_header.hpp>

#if BOOST_VMD_MSVC

#define SOME_MACRO ... code for VC++ using its default preprocessor

#else

#define SOME_MACRO ... code for all other compilers

#endif

The BOOST_VMD_MSVC macro only applies when the VC++ default preprocessor is being used. It does not apply when VC++'s new standard conforming preprocessor, currently activated by the /Zc:preprocessor command line option, is being used.


PrevUpHomeNext