• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>Using variadic macros</title>
5<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7<link rel="home" href="../index.html" title="Chapter 1. The Variadic Macro Data Library 1.9">
8<link rel="up" href="../index.html" title="Chapter 1. The Variadic Macro Data Library 1.9">
9<link rel="prev" href="vmd_whyhow.html" title="Why and how to use">
10<link rel="next" href="vmd_vc.html" title="Visual C++ define">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%"><tr>
14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
15<td align="center"><a href="../../../../../index.html">Home</a></td>
16<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19<td align="center"><a href="../../../../../more/index.htm">More</a></td>
20</tr></table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="vmd_whyhow.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="vmd_vc.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h2 class="title" style="clear: both">
27<a name="variadic_macro_data.vmd_vmacros"></a><a class="link" href="vmd_vmacros.html" title="Using variadic macros">Using variadic macros</a>
28</h2></div></div></div>
29<p>
30      Variadic macros, as specified by C++11, is a feature taken from the C99 specification.
31      They are macros which take a final parameter denoted as '...' which represents
32      one or more final arguments to the macro as a series of comma-separated tokens.
33      In the macro expansion a special keyword of <code class="computeroutput"><span class="identifier">__VA_ARGS__</span></code>
34      represents the comma-separated tokens. This information when passed to a variadic
35      macro I call 'variadic macro data', which gives its name to this library. The
36      more general term 'variadic data' is used in this documentation to specify
37      data passed to a macro which can contain any number of macro tokens as a single
38      macro parameter, such as is found in Boost PP data types.
39    </p>
40<h4>
41<a name="variadic_macro_data.vmd_vmacros.h0"></a>
42      <span class="phrase"><a name="variadic_macro_data.vmd_vmacros.boost_support"></a></span><a class="link" href="vmd_vmacros.html#variadic_macro_data.vmd_vmacros.boost_support">Boost
43      support</a>
44    </h4>
45<p>
46      The Boost PP library has support for variadic macros and uses its own criteria
47      to determine if a particular compiler has that support. Boost PP defines or
48      uses the macro BOOST_PP_VARIADICS to denote whether the compiler being used
49      supports variadic macros. When BOOST_PP_VARIADICS is set to 1 the compiler
50      supports variadic macros, otherwise when BOOST_PP_VARIADICS is set to 0 the
51      compiler does not support variadic macros. If a user of Boost PP sets this
52      value, Boost PP uses the value the end-user sets, otherwise Boost PP defines
53      the value of BOOST_PP_VARIADICS based on its own analysis of the compiler being
54      used. This macro can also be checked to determine if a compiler has support
55      for variadic macros.
56    </p>
57<h4>
58<a name="variadic_macro_data.vmd_vmacros.h1"></a>
59      <span class="phrase"><a name="variadic_macro_data.vmd_vmacros.determining_variadic_macro_suppo"></a></span><a class="link" href="vmd_vmacros.html#variadic_macro_data.vmd_vmacros.determining_variadic_macro_suppo">Determining
60      variadic macro support</a>
61    </h4>
62<p>
63      The VMD library automatically determines whether variadic macro support is
64      enabled for a particular compiler by also using the same BOOST_PP_VARIADICS
65      macro from Boost PP. The end-user of VMD can also manually set the macro BOOST_PP_VARIADICS
66      to turn on or off compiler support for variadic macros in the VMD library.
67      When BOOST_PP_VARIADICS is set to 0 variadic macros are not supported in the
68      VMD library, otherwise when BOOST_PP_VARIADICS is set to non-zero they are
69      supported in the VMD library. This same macro can be used to determine if VMD
70      supports variadic macros for a particular compiler.
71    </p>
72<p>
73      Since this library completely depends on variadic macro support, if BOOST_PP_VARIADICS
74      is set to 0, using any of the macros in VMD will lead to a compiler error since
75      the macro will not be defined. However just including any of the header files
76      in VMD, even with no variadic macro support for the compiler, will not lead
77      to any compiler errors.
78    </p>
79</div>
80<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
81<td align="left"></td>
82<td align="right"><div class="copyright-footer">Copyright © 2010-2017 Tropic Software
83      East Inc</div></td>
84</tr></table>
85<hr>
86<div class="spirit-nav">
87<a accesskey="p" href="vmd_whyhow.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="vmd_vc.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
88</div>
89</body>
90</html>
91