forked from boostorg/utility
58 lines
2.6 KiB
HTML
58 lines
2.6 KiB
HTML
![]() |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|||
|
<html>
|
|||
|
<head>
|
|||
|
<title>Boost: assert.hpp documentation</title>
|
|||
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|||
|
</head>
|
|||
|
<body bgcolor="white" style="MARGIN-LEFT: 5%; MARGIN-RIGHT: 5%">
|
|||
|
<table border="0" width="100%">
|
|||
|
<tr>
|
|||
|
<td width="277">
|
|||
|
<img src="../../c++boost.gif" alt="c++boost.gif (8819 bytes)" width="277" height="86">
|
|||
|
</td>
|
|||
|
<td align="middle">
|
|||
|
<h1>assert.hpp</h1>
|
|||
|
</td>
|
|||
|
</tr>
|
|||
|
<tr>
|
|||
|
<td colspan="2" height="64"> </td>
|
|||
|
</tr>
|
|||
|
</table>
|
|||
|
<p>
|
|||
|
The header <STRONG><boost/assert.hpp></STRONG> defines the macro <b>BOOST_ASSERT</b>,
|
|||
|
which is similar to the standard <STRONG>assert</STRONG> macro defined in <STRONG><cassert></STRONG>.
|
|||
|
The macro is intended to be used in Boost libraries.
|
|||
|
</p>
|
|||
|
<P>By default, <tt>BOOST_ASSERT(expr)</tt> is equivalent to <tt>assert(expr)</tt>.</P>
|
|||
|
<P>When the macro <STRONG>BOOST_DISABLE_ASSERTS</STRONG> is defined when <STRONG><boost/assert.hpp></STRONG>
|
|||
|
is included, <tt>BOOST_ASSERT(expr)</tt> is defined as <tt>((void)0)</tt>. This
|
|||
|
allows users to selectively disable <STRONG>BOOST_ASSERT</STRONG> without
|
|||
|
affecting the definition of the standard <STRONG>assert</STRONG>.</P>
|
|||
|
<P>When the macro <STRONG>BOOST_ENABLE_ASSERT_HANDLER</STRONG> is defined when <STRONG><boost/assert.hpp></STRONG>
|
|||
|
is included, <tt>BOOST_ASSERT(expr)</tt> evaluates <b>expr</b> and, if the
|
|||
|
result is false, evaluates the expression</P>
|
|||
|
<P><tt>::boost::assertion_failed(#expr, <a href="current_function.html">BOOST_CURRENT_FUNCTION</a>,
|
|||
|
__FILE__, __LINE__)</tt></P>
|
|||
|
<P><STRONG>assertion_failed</STRONG> is declared in <STRONG><boost/assert.hpp></STRONG>
|
|||
|
as</P>
|
|||
|
<pre>
|
|||
|
namespace boost
|
|||
|
{
|
|||
|
|
|||
|
void assertion_failed(char const * expr, char const * function, char const * file, long line);
|
|||
|
|
|||
|
}
|
|||
|
</pre>
|
|||
|
<p>but it is never defined. The user is expected to supply an appropriate
|
|||
|
definition.</p>
|
|||
|
<P>As is the case with <STRONG><cassert></STRONG>, <STRONG><boost/assert.hpp></STRONG>
|
|||
|
can be included multiple times in a single translation unit. <STRONG>BOOST_ASSERT</STRONG>
|
|||
|
will be redefined each time as specified above.</P>
|
|||
|
<p><br>
|
|||
|
<small>Copyright <20> 2002 by Peter Dimov. Permission to copy, use, modify, sell and
|
|||
|
distribute this document is granted provided this copyright notice appears in
|
|||
|
all copies. This document is provided "as is" without express or implied
|
|||
|
warranty, and with no claim as to its suitability for any purpose.</small></p>
|
|||
|
</body>
|
|||
|
</html>
|