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 a snapshot of the develop branch, built from commit 26d7d9b59f.
PrevUpHomeNext

Using variadic macros

Variadic macros, as specified by C++11, is a feature taken from the C99 specification. They are macros which take a final parameter denoted as '...' which represents one or more final arguments to the macro as a series of comma-separated tokens. In the macro expansion a special keyword of __VA_ARGS__ represents the comma-separated tokens. This information when passed to a variadic macro I call 'variadic macro data', which gives its name to this library. The more general term 'variadic data' is used in this documentation to specify data passed to a macro which can contain any number of macro tokens as a single macro parameter, such as is found in Boost PP data types.

The library assumes variadic macro support. If a compiler does not support variadic macros the macros in the library will fail with preprocessor errors. In previous versions of this library variadic macro support was determined by the value of the BOOST_PP_VARIADICS object-like macro from the Boost Preprocessor library, so that if this macro returned 0, none of the macros in the library would be defined. This is no longer the case since the Boost preprocessor library now also requires variadic macro support and BOOST_PP_VARIADICS always returns 1.

What this means for the end-user is that the compiler must be used in C++11 or higher mode, or that a compiler in C++98/C++03 mode supports variadic macros. A number of major compilers, including Visual C++, gcc, and clang. do support variadic macros in C++98/C++03 mode, as long as strict compliance to the C++98/C++03 standard is not turned on through that compiler's compiler flags.


PrevUpHomeNext