[29] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
---|
| 2 | <html> |
---|
| 3 | <head> |
---|
| 4 | <title>Boost: assert.hpp documentation</title> |
---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
---|
| 6 | </head> |
---|
| 7 | <body bgcolor="white" style="MARGIN-LEFT: 5%; MARGIN-RIGHT: 5%"> |
---|
| 8 | <table border="0" width="100%"> |
---|
| 9 | <tr> |
---|
| 10 | <td width="277"><A href="../../index.htm"> <img src="../../boost.png" alt="boost.png (6897 bytes)" width="277" height="86" border="0"></A> |
---|
| 11 | </td> |
---|
| 12 | <td align="center"> |
---|
| 13 | <h1>assert.hpp</h1> |
---|
| 14 | </td> |
---|
| 15 | </tr> |
---|
| 16 | <tr> |
---|
| 17 | <td colspan="2" height="64"> </td> |
---|
| 18 | </tr> |
---|
| 19 | </table> |
---|
| 20 | <p> |
---|
| 21 | The header <STRONG><boost/assert.hpp></STRONG> defines the macro <b>BOOST_ASSERT</b>, |
---|
| 22 | which is similar to the standard <STRONG>assert</STRONG> macro defined in <STRONG><cassert></STRONG>. |
---|
| 23 | The macro is intended to be used in Boost libraries. |
---|
| 24 | </p> |
---|
| 25 | <P>By default, <tt>BOOST_ASSERT(expr)</tt> is equivalent to <tt>assert(expr)</tt>.</P> |
---|
| 26 | <P>When the macro <STRONG>BOOST_DISABLE_ASSERTS</STRONG> is defined when <STRONG><boost/assert.hpp></STRONG> |
---|
| 27 | is included, <tt>BOOST_ASSERT(expr)</tt> is defined as <tt>((void)0)</tt>. This |
---|
| 28 | allows users to selectively disable <STRONG>BOOST_ASSERT</STRONG> without |
---|
| 29 | affecting the definition of the standard <STRONG>assert</STRONG>.</P> |
---|
| 30 | <P>When the macro <STRONG>BOOST_ENABLE_ASSERT_HANDLER</STRONG> is defined when <STRONG><boost/assert.hpp></STRONG> |
---|
| 31 | is included, <tt>BOOST_ASSERT(expr)</tt> evaluates <b>expr</b> and, if the |
---|
| 32 | result is false, evaluates the expression</P> |
---|
| 33 | <P><tt>::boost::assertion_failed(#expr, <a href="current_function.html">BOOST_CURRENT_FUNCTION</a>, |
---|
| 34 | __FILE__, __LINE__)</tt></P> |
---|
| 35 | <P><STRONG>assertion_failed</STRONG> is declared in <STRONG><boost/assert.hpp></STRONG> |
---|
| 36 | as</P> |
---|
| 37 | <pre> |
---|
| 38 | namespace boost |
---|
| 39 | { |
---|
| 40 | |
---|
| 41 | void assertion_failed(char const * expr, char const * function, char const * file, long line); |
---|
| 42 | |
---|
| 43 | } |
---|
| 44 | </pre> |
---|
| 45 | <p>but it is never defined. The user is expected to supply an appropriate |
---|
| 46 | definition.</p> |
---|
| 47 | <P>As is the case with <STRONG><cassert></STRONG>, <STRONG><boost/assert.hpp></STRONG> |
---|
| 48 | can be included multiple times in a single translation unit. <STRONG>BOOST_ASSERT</STRONG> |
---|
| 49 | will be redefined each time as specified above.</P> |
---|
| 50 | <p><br> |
---|
| 51 | <small>Copyright © 2002 by Peter Dimov. Distributed under the Boost Software License, Version |
---|
| 52 | 1.0. See accompanying file <A href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</A> or |
---|
| 53 | copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>.</small></p> |
---|
| 54 | </body> |
---|
| 55 | </html> |
---|