forked from boostorg/preprocessor
Rearrangement of links and better explanation of variadic macro support.
This commit is contained in:
@ -1,6 +1,8 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta content="text/html; charset=windows-1252" http-equiv="content-type">
|
<meta content="text/html; charset=windows-1252"
|
||||||
|
http-equiv="content-type">
|
||||||
<title>contents.html</title>
|
<title>contents.html</title>
|
||||||
<link rel="stylesheet" type="text/css" href="styles.css">
|
<link rel="stylesheet" type="text/css" href="styles.css">
|
||||||
<style>
|
<style>
|
||||||
@ -8,27 +10,24 @@
|
|||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h4><a href="AppendixA-AnIntroductiontoPreprocessorMetaprogramming.html"
|
<h4><a href="index.html" target="_top">Introduction</a></h4>
|
||||||
target="_top">Introduction</a></h4>
|
<h4><a
|
||||||
|
href="AppendixA-AnIntroductiontoPreprocessorMetaprogramming.html"
|
||||||
|
target="_top">Basic Intro</a></h4>
|
||||||
|
<a href="topics.html"> </a>
|
||||||
<h4><a href="topics.html">Topics</a></h4>
|
<h4><a href="topics.html">Topics</a></h4>
|
||||||
<a href="topics.html">
|
<a href="topics.html"> </a>
|
||||||
</a>
|
<h4><a href="terms.html">Terminology</a></h4>
|
||||||
<h4><a href="topics.html"></a><a href="terms.html">Terminology</a></h4>
|
<a href="terms.html"> </a>
|
||||||
<a href="terms.html">
|
<h4><a href="data.html">Data Types</a></h4>
|
||||||
</a>
|
<a href="data.html"> </a>
|
||||||
<h4><a href="terms.html"></a><a href="data.html">Data Types</a></h4>
|
<h4><a href="ref.html">Reference</a></h4>
|
||||||
<a href="data.html">
|
<a href="ref.html"> </a>
|
||||||
</a>
|
<h4><a href="headers.html">Headers</a></h4>
|
||||||
<h4><a href="data.html"></a><a href="ref.html">Reference</a></h4>
|
<a href="headers.html"> </a>
|
||||||
<a href="ref.html">
|
<h4><a href="examples.html">Examples</a></h4>
|
||||||
</a>
|
<a href="examples.html"> </a>
|
||||||
<h4><a href="ref.html"></a><a href="headers.html">Headers</a></h4>
|
<h4><a href="miscellanea.html">Miscellanea</a></h4>
|
||||||
<a href="headers.html">
|
|
||||||
</a>
|
|
||||||
<h4><a href="headers.html"></a><a href="examples.html">Examples</a></h4>
|
|
||||||
<a href="examples.html">
|
|
||||||
</a>
|
|
||||||
<h4><a href="examples.html"></a><a href="miscellanea.html">Miscellanea</a></h4>
|
|
||||||
<a href="miscellanea.html">
|
<a href="miscellanea.html">
|
||||||
<!--
|
<!--
|
||||||
<EFBFBD> Copyright Housemarque Oy 2002<30> Copyright Paul Mensonides 2002
|
<EFBFBD> Copyright Housemarque Oy 2002<30> Copyright Paul Mensonides 2002
|
||||||
|
@ -13,13 +13,13 @@
|
|||||||
both C++ and C compilation. It does not depend on any other Boost
|
both C++ and C compilation. It does not depend on any other Boost
|
||||||
libraries and therefore may be used as a standalone library.<br>
|
libraries and therefore may be used as a standalone library.<br>
|
||||||
</div>
|
</div>
|
||||||
<div>The library assumes that the compiler supports variadic macros.
|
<div>The library requires that the compiler supports <a
|
||||||
Since variadic macros are a C99 or C++11 feature the library
|
href="topics/variadic_macros.html">variadic macros</a>. Since
|
||||||
ostensibly requires at least compilation at those C or C++
|
variadic macros are a C99 or C++11 feature the library ostensibly
|
||||||
standard levels. A number of compilers support variadic macros at
|
requires at least compilation at those C or C++ standard levels. A
|
||||||
a lower level, so it still may be possible using the library at
|
number of compilers support variadic macros at a lower level, so
|
||||||
the C++03 compilation level, as long as strict C++03 compliance is
|
it still may be possible using the library at that compilation
|
||||||
not enforced.<br>
|
level, as long as strict C++98/C++03 compliance is not enforced.<br>
|
||||||
</div>
|
</div>
|
||||||
<div> An excerpt from <i>C++ Template Metaprogramming: Concepts,
|
<div> An excerpt from <i>C++ Template Metaprogramming: Concepts,
|
||||||
Tools, and Techniques from Boost and Beyond</i> by Dave Abrahams
|
Tools, and Techniques from Boost and Beyond</i> by Dave Abrahams
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h4>Variadic Macros</h4>
|
<h4>Variadic Macros</h4>
|
||||||
<div> Variadic macros are supported by nearly all compilers. This library assumes
|
<div> Variadic macros are supported by nearly all compilers.
|
||||||
the compiler supports variadic macros. Variadic macros are macros of the form: </div>
|
Variadic macros are macros of the form: </div>
|
||||||
<div class="code">
|
<div class="code">
|
||||||
<pre>#define SOME_MACRO(ZeroOrMoreParameters,...) macro expansion possible specifying __VA_ARGS__</pre>
|
<pre>#define SOME_MACRO(ZeroOrMoreParameters,...) macro expansion possible specifying __VA_ARGS__</pre>
|
||||||
</div>
|
</div>
|
||||||
@ -37,15 +37,27 @@
|
|||||||
</div>
|
</div>
|
||||||
<u> <span style="font-weight: bold;">Preprocessor Library Support<br>
|
<u> <span style="font-weight: bold;">Preprocessor Library Support<br>
|
||||||
</span></u>
|
</span></u>
|
||||||
<div>The library assumes support for variadic macros for all
|
<div>The library requires support for variadic macros for all
|
||||||
compilers using the library.<br>
|
compilers using the library. This usually means that compilation
|
||||||
|
at the C level is C99 or higher and that compilation at the C++
|
||||||
|
level is C++11 or higher. Many C++ compilers support variadic
|
||||||
|
macros at the C++98/C++03 level as long as strict compliance is
|
||||||
|
not turned on for those compilers at that level. In particular
|
||||||
|
both the gcc and clang compilers will support variadic macros at
|
||||||
|
the C++98/C++03 levels as long as strict ANSI compliance is not
|
||||||
|
turned on at that level. For those compilers this largely means
|
||||||
|
that the <code>-pedantic</code> or <code>-pedantic-errors</code>
|
||||||
|
option is not used at the C++98/C++03 level of compilation. Boost
|
||||||
|
C++ is deprecating compiling Boost libraries at the C++98/C++03
|
||||||
|
level, so if you must still use this library at that level be
|
||||||
|
aware of these aforementioned caveats.<br>
|
||||||
<br>
|
<br>
|
||||||
<a name="vmvcquirk"></a>Visual C++'s default preprocessor has a few
|
<a name="vmvcquirk"></a>Visual C++'s default preprocessor has a
|
||||||
quirks related to variadic macros which require the end-user to code
|
few quirks related to variadic macros which require the end-user
|
||||||
slightly differently. When Visual C++'s default preprocessor is being
|
to code slightly differently. When Visual C++'s default
|
||||||
used BOOST_PP_VARIADICS_MSVC is 1, otherwise it is 0. In this way the
|
preprocessor is being used BOOST_PP_VARIADICS_MSVC is 1, otherwise
|
||||||
end-user can test for the presence of Visual C++'s default preprocessor
|
it is 0. In this way the end-user can test for the presence of
|
||||||
and code accordingly.<br>
|
Visual C++'s default preprocessor and code accordingly.<br>
|
||||||
<br>
|
<br>
|
||||||
Support for working with variadic data is largely centered on
|
Support for working with variadic data is largely centered on
|
||||||
being able to convert variadic data to other library data types,
|
being able to convert variadic data to other library data types,
|
||||||
@ -63,9 +75,9 @@
|
|||||||
of the ability of the variadic parameters to encompass a variable
|
of the ability of the variadic parameters to encompass a variable
|
||||||
number of arguments. The library has functionality which can know
|
number of arguments. The library has functionality which can know
|
||||||
the number of variadic arguments passed when invoking a variadic
|
the number of variadic arguments passed when invoking a variadic
|
||||||
macro. This allows the same variadic macro to work
|
macro. This allows the same variadic macro to work with different
|
||||||
with different numbers of parameters, therefore providing more
|
numbers of parameters, therefore providing more than one
|
||||||
than one syntactical equivalent for the same macro name.<br>
|
syntactical equivalent for the same macro name.<br>
|
||||||
<br>
|
<br>
|
||||||
The macros in the library which offer this enhanced functionality
|
The macros in the library which offer this enhanced functionality
|
||||||
are all centered on <i>tuple</i> manipulation. With variadic
|
are all centered on <i>tuple</i> manipulation. With variadic
|
||||||
@ -148,12 +160,12 @@
|
|||||||
<div>An array as a preprocessor data type is a two-element tuple
|
<div>An array as a preprocessor data type is a two-element tuple
|
||||||
where the first element is the array size and the second element
|
where the first element is the array size and the second element
|
||||||
is a tuple which constitutes the array data. Because a tuple knows
|
is a tuple which constitutes the array data. Because a tuple knows
|
||||||
its own size because of compiler support for variadic macros, there is
|
its own size because of compiler support for variadic macros,
|
||||||
no reason to use the array preprocessor data type as opposed to
|
there is no reason to use the array preprocessor data type as
|
||||||
the tuple preprocessor data type; the tuple data type now has all
|
opposed to the tuple preprocessor data type; the tuple data type
|
||||||
of the functionality which the array data type has and is
|
now has all of the functionality which the array data type has and
|
||||||
syntactically easier to use. The preprocessor array data type is
|
is syntactically easier to use. The preprocessor array data type
|
||||||
essentially obsolete for modern C++ compilers.</div>
|
is essentially obsolete for modern C++ compilers.</div>
|
||||||
<u style="font-weight: bold;">Using Variadic Data</u>
|
<u style="font-weight: bold;">Using Variadic Data</u>
|
||||||
<div>Variadic data exists in the form of comma-separated
|
<div>Variadic data exists in the form of comma-separated
|
||||||
preprocessor tokens. This is the case whether the variadic data
|
preprocessor tokens. This is the case whether the variadic data
|
||||||
@ -180,10 +192,10 @@
|
|||||||
to work and may fail.<br>
|
to work and may fail.<br>
|
||||||
</span><br>
|
</span><br>
|
||||||
This occurs because of a preprocessor weakness in a number of
|
This occurs because of a preprocessor weakness in a number of
|
||||||
compilers, currently most notably Visual C++'s default preprocessor.
|
compilers, currently most notably Visual C++'s default
|
||||||
Even passing variadic data as arguments to a non-variadic macro, when
|
preprocessor. Even passing variadic data as arguments to a
|
||||||
it is not represented in the form of __VA_ARGS__, may fail with
|
non-variadic macro, when it is not represented in the form
|
||||||
certain compilers.<br>
|
of __VA_ARGS__, may fail with certain compilers.<br>
|
||||||
<br>
|
<br>
|
||||||
What follows are very simple examples, showing how variadic data
|
What follows are very simple examples, showing how variadic data
|
||||||
can be passed to a non-variadic macro.<br>
|
can be passed to a non-variadic macro.<br>
|
||||||
|
Reference in New Issue
Block a user