mirror of
https://github.com/boostorg/preprocessor.git
synced 2025-06-25 03:51:37 +02:00
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>
|
||||
<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>
|
||||
<link rel="stylesheet" type="text/css" href="styles.css">
|
||||
<style>
|
||||
@ -8,27 +10,24 @@
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h4><a href="AppendixA-AnIntroductiontoPreprocessorMetaprogramming.html"
|
||||
target="_top">Introduction</a></h4>
|
||||
<h4><a href="index.html" 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>
|
||||
<a href="topics.html">
|
||||
</a>
|
||||
<h4><a href="topics.html"></a><a href="terms.html">Terminology</a></h4>
|
||||
<a href="terms.html">
|
||||
</a>
|
||||
<h4><a href="terms.html"></a><a href="data.html">Data Types</a></h4>
|
||||
<a href="data.html">
|
||||
</a>
|
||||
<h4><a href="data.html"></a><a href="ref.html">Reference</a></h4>
|
||||
<a href="ref.html">
|
||||
</a>
|
||||
<h4><a href="ref.html"></a><a href="headers.html">Headers</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="topics.html"> </a>
|
||||
<h4><a href="terms.html">Terminology</a></h4>
|
||||
<a href="terms.html"> </a>
|
||||
<h4><a href="data.html">Data Types</a></h4>
|
||||
<a href="data.html"> </a>
|
||||
<h4><a href="ref.html">Reference</a></h4>
|
||||
<a href="ref.html"> </a>
|
||||
<h4><a href="headers.html">Headers</a></h4>
|
||||
<a href="headers.html"> </a>
|
||||
<h4><a href="examples.html">Examples</a></h4>
|
||||
<a href="examples.html"> </a>
|
||||
<h4><a href="miscellanea.html">Miscellanea</a></h4>
|
||||
<a href="miscellanea.html">
|
||||
<!--
|
||||
<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
|
||||
libraries and therefore may be used as a standalone library.<br>
|
||||
</div>
|
||||
<div>The library assumes that the compiler supports variadic macros.
|
||||
Since variadic macros are a C99 or C++11 feature the library
|
||||
ostensibly requires at least compilation at those C or C++
|
||||
standard levels. A number of compilers support variadic macros at
|
||||
a lower level, so it still may be possible using the library at
|
||||
the C++03 compilation level, as long as strict C++03 compliance is
|
||||
not enforced.<br>
|
||||
<div>The library requires that the compiler supports <a
|
||||
href="topics/variadic_macros.html">variadic macros</a>. Since
|
||||
variadic macros are a C99 or C++11 feature the library ostensibly
|
||||
requires at least compilation at those C or C++ standard levels. A
|
||||
number of compilers support variadic macros at a lower level, so
|
||||
it still may be possible using the library at that compilation
|
||||
level, as long as strict C++98/C++03 compliance is not enforced.<br>
|
||||
</div>
|
||||
<div> An excerpt from <i>C++ Template Metaprogramming: Concepts,
|
||||
Tools, and Techniques from Boost and Beyond</i> by Dave Abrahams
|
||||
|
@ -11,8 +11,8 @@
|
||||
</head>
|
||||
<body>
|
||||
<h4>Variadic Macros</h4>
|
||||
<div> Variadic macros are supported by nearly all compilers. This library assumes
|
||||
the compiler supports variadic macros. Variadic macros are macros of the form: </div>
|
||||
<div> Variadic macros are supported by nearly all compilers.
|
||||
Variadic macros are macros of the form: </div>
|
||||
<div class="code">
|
||||
<pre>#define SOME_MACRO(ZeroOrMoreParameters,...) macro expansion possible specifying __VA_ARGS__</pre>
|
||||
</div>
|
||||
@ -37,15 +37,27 @@
|
||||
</div>
|
||||
<u> <span style="font-weight: bold;">Preprocessor Library Support<br>
|
||||
</span></u>
|
||||
<div>The library assumes support for variadic macros for all
|
||||
compilers using the library.<br>
|
||||
<div>The library requires support for variadic macros for all
|
||||
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>
|
||||
<a name="vmvcquirk"></a>Visual C++'s default preprocessor has a few
|
||||
quirks related to variadic macros which require the end-user to code
|
||||
slightly differently. When Visual C++'s default preprocessor is being
|
||||
used BOOST_PP_VARIADICS_MSVC is 1, otherwise it is 0. In this way the
|
||||
end-user can test for the presence of Visual C++'s default preprocessor
|
||||
and code accordingly.<br>
|
||||
<a name="vmvcquirk"></a>Visual C++'s default preprocessor has a
|
||||
few quirks related to variadic macros which require the end-user
|
||||
to code slightly differently. When Visual C++'s default
|
||||
preprocessor is being used BOOST_PP_VARIADICS_MSVC is 1, otherwise
|
||||
it is 0. In this way the end-user can test for the presence of
|
||||
Visual C++'s default preprocessor and code accordingly.<br>
|
||||
<br>
|
||||
Support for working with variadic data is largely centered on
|
||||
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
|
||||
number of arguments. The library has functionality which can know
|
||||
the number of variadic arguments passed when invoking a variadic
|
||||
macro. This allows the same variadic macro to work
|
||||
with different numbers of parameters, therefore providing more
|
||||
than one syntactical equivalent for the same macro name.<br>
|
||||
macro. This allows the same variadic macro to work with different
|
||||
numbers of parameters, therefore providing more than one
|
||||
syntactical equivalent for the same macro name.<br>
|
||||
<br>
|
||||
The macros in the library which offer this enhanced functionality
|
||||
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
|
||||
where the first element is the array size and the second element
|
||||
is a tuple which constitutes the array data. Because a tuple knows
|
||||
its own size because of compiler support for variadic macros, there is
|
||||
no reason to use the array preprocessor data type as opposed to
|
||||
the tuple preprocessor data type; the tuple data type now has all
|
||||
of the functionality which the array data type has and is
|
||||
syntactically easier to use. The preprocessor array data type is
|
||||
essentially obsolete for modern C++ compilers.</div>
|
||||
its own size because of compiler support for variadic macros,
|
||||
there is no reason to use the array preprocessor data type as
|
||||
opposed to the tuple preprocessor data type; the tuple data type
|
||||
now has all of the functionality which the array data type has and
|
||||
is syntactically easier to use. The preprocessor array data type
|
||||
is essentially obsolete for modern C++ compilers.</div>
|
||||
<u style="font-weight: bold;">Using Variadic Data</u>
|
||||
<div>Variadic data exists in the form of comma-separated
|
||||
preprocessor tokens. This is the case whether the variadic data
|
||||
@ -180,10 +192,10 @@
|
||||
to work and may fail.<br>
|
||||
</span><br>
|
||||
This occurs because of a preprocessor weakness in a number of
|
||||
compilers, currently most notably Visual C++'s default preprocessor.
|
||||
Even passing variadic data as arguments to a non-variadic macro, when
|
||||
it is not represented in the form of __VA_ARGS__, may fail with
|
||||
certain compilers.<br>
|
||||
compilers, currently most notably Visual C++'s default
|
||||
preprocessor. Even passing variadic data as arguments to a
|
||||
non-variadic macro, when it is not represented in the form
|
||||
of __VA_ARGS__, may fail with certain compilers.<br>
|
||||
<br>
|
||||
What follows are very simple examples, showing how variadic data
|
||||
can be passed to a non-variadic macro.<br>
|
||||
|
Reference in New Issue
Block a user