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"> |
---|
11 | <img src="../../boost.png" alt="boost.png (6897 bytes)" width="277" height="86"> |
---|
12 | </td> |
---|
13 | <td align="middle"> |
---|
14 | <h1>assert.hpp</h1> |
---|
15 | </td> |
---|
16 | </tr> |
---|
17 | <tr> |
---|
18 | <td colspan="2" height="64"> </td> |
---|
19 | </tr> |
---|
20 | </table> |
---|
21 | <p> |
---|
22 | The header <STRONG><boost/assert.hpp></STRONG> defines the macro <b>BOOST_ASSERT</b>, |
---|
23 | which is similar to the standard <STRONG>assert</STRONG> macro defined in <STRONG><cassert></STRONG>. |
---|
24 | The macro is intended to be used in Boost libraries. |
---|
25 | </p> |
---|
26 | <P>By default, <tt>BOOST_ASSERT(expr)</tt> is equivalent to <tt>assert(expr)</tt>.</P> |
---|
27 | <P>When the macro <STRONG>BOOST_DISABLE_ASSERTS</STRONG> is defined when <STRONG><boost/assert.hpp></STRONG> |
---|
28 | is included, <tt>BOOST_ASSERT(expr)</tt> is defined as <tt>((void)0)</tt>. This |
---|
29 | allows users to selectively disable <STRONG>BOOST_ASSERT</STRONG> without |
---|
30 | affecting the definition of the standard <STRONG>assert</STRONG>.</P> |
---|
31 | <P>When the macro <STRONG>BOOST_ENABLE_ASSERT_HANDLER</STRONG> is defined when <STRONG><boost/assert.hpp></STRONG> |
---|
32 | is included, <tt>BOOST_ASSERT(expr)</tt> evaluates <b>expr</b> and, if the |
---|
33 | result is false, evaluates the expression</P> |
---|
34 | <P><tt>::boost::assertion_failed(#expr, <a href="current_function.html">BOOST_CURRENT_FUNCTION</a>, |
---|
35 | __FILE__, __LINE__)</tt></P> |
---|
36 | <P><STRONG>assertion_failed</STRONG> is declared in <STRONG><boost/assert.hpp></STRONG> |
---|
37 | as</P> |
---|
38 | <pre> |
---|
39 | namespace boost |
---|
40 | { |
---|
41 | |
---|
42 | void assertion_failed(char const * expr, char const * function, char const * file, long line); |
---|
43 | |
---|
44 | } |
---|
45 | </pre> |
---|
46 | <p>but it is never defined. The user is expected to supply an appropriate |
---|
47 | definition.</p> |
---|
48 | <P>As is the case with <STRONG><cassert></STRONG>, <STRONG><boost/assert.hpp></STRONG> |
---|
49 | can be included multiple times in a single translation unit. <STRONG>BOOST_ASSERT</STRONG> |
---|
50 | will be redefined each time as specified above.</P> |
---|
51 | <p><br> |
---|
52 | <small>Copyright © 2002 by Peter Dimov. Permission to copy, use, modify, sell and |
---|
53 | distribute this document is granted provided this copyright notice appears in |
---|
54 | all copies. This document is provided "as is" without express or implied |
---|
55 | warranty, and with no claim as to its suitability for any purpose.</small></p> |
---|
56 | </body> |
---|
57 | </html> |
---|