Files
boost_preprocessor/docs.1/ref/assert.html
Paul Mensonides cdc4be5256 initial revision
[SVN r15198]
2002-09-08 09:40:56 +00:00

97 lines
3.0 KiB
HTML

<html>
<head>
<title>BOOST_PP_ASSERT</title>
<link rel="stylesheet" type="text/css" href="../styles.css">
<script language="javascript" type="text/javascript" src="../scripts.js"></script>
</head>
<body onload="init('sample');">
<div style="margin-left: 0px;">
The <b>BOOST_PP_ASSERT</b> macro conditionally causes a preprocessing error.
</div>
<h4>Usage</h4>
<div class="code">
<b>BOOST_PP_ASSERT</b>(<i>cond</i>)
</div>
<h4>Arguments</h4>
<dl>
<dt>cond</dt>
<dd>
A condition that determines whether an assertion occurs.&nbsp;
Valid values range from <i>0</i> to <b>BOOST_PP_LIMIT_MAG</b>.
</dd>
</dl>
<h4>Remarks</h4>
<div>
If <i>cond</i> expands to <i>0</i>, this macro causes a preprocessing error.&nbsp;
Otherwise, it expands to nothing.
</div>
<h4>See Also</h4>
<ul>
<li><a href="assert_msg.html">BOOST_PP_ASSERT_MSG</a></li>
<li><a href="limit_mag.html">BOOST_PP_LIMIT_MAG</a></li>
</ul>
<h4>Requirements</h4>
<div>
<b>Header:</b> &nbsp;<a href="../headers/debug/assert.hpp.html">&lt;boost/preprocessor/debug/assert.hpp&gt;</a>
</div>
<h4><a class="local" onclick="toggle('sample');" onmouseover="change(this);" onmouseout="revert(this);">Sample Code</a></h4>
<div id="sample"><pre>
#include &lt;boost/preprocessor/cat.hpp&gt;
#include &lt;boost/preprocessor/debug/assert.hpp&gt;
#include &lt;boost/preprocessor/detail/is_nullary.hpp&gt;
#include &lt;boost/preprocessor/logical/bitnor.hpp&gt;
#include &lt;boost/preprocessor/logical/compl.hpp&gt;
#define IS_EDISON_DESIGN_GROUP() /* ..... */ \
BOOST_PP_COMPL( \
BOOST_PP_IS_NULLARY( \
BOOST_PP_CAT(IS_EDG_CHECK, __EDG__) \
) \
) \
/**/
#define IS_EDG_CHECK__EDG__ ()
#define IS_METROWERKS() /* .................... */ \
BOOST_PP_COMPL( \
BOOST_PP_IS_NULLARY( \
BOOST_PP_CAT(IS_MWERKS_CHECK, __MWERKS__) \
) \
) \
/**/
#define IS_MWERKS_CHECK__MWERKS__ ()
#define IS_MICROSOFT() /* ... */ \
BOOST_PP_BITNOR( \
IS_MICROSOFT_ROOT(), \
IS_EDISON_DESIGN_GROUP() \
) \
/**/
#define IS_MICROSOFT_ROOT() /* ......... */ \
BOOST_PP_IS_NULLARY( \
BOOST_PP_CAT(IS_MSVC_CHECK, _MSC_VER) \
) \
/**/
#define IS_MSVC_CHECK_MS_VER ()
// this macro doesn't work on EDG...
// (this is just an example)
#define MACRO(n) /* ....... */ \
BOOST_PP_CAT( \
MACRO_, \
IS_EDISON_DESIGN_GROUP() \
)(n) \
/**/
#define MACRO_1(n) /* ................ */ \
BOOST_PP_ASSERT(0) \
"Edison Design Group is not supported" \
/**/
#define MACRO_0(n) normal mode: n
MACRO(10)
<pre></div>
</body>
</html>