File: assert.html

package info (click to toggle)
boost1.35 1.35.0-5
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 203,856 kB
  • ctags: 337,867
  • sloc: cpp: 938,683; xml: 56,847; ansic: 41,589; python: 18,999; sh: 11,566; makefile: 664; perl: 494; yacc: 456; asm: 353; csh: 6
file content (61 lines) | stat: -rw-r--r-- 3,107 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!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"><A href="../../index.htm"> <img src="../../boost.png" alt="boost.png (6897 bytes)" width="277" height="86" border="0"></A>
				</td>
				<td align="center">
					<h1>assert.hpp</h1>
				</td>
			</tr>
			<tr>
				<td colspan="2" height="64">&nbsp;</td>
			</tr>
		</table>
		<p>
			The header <STRONG>&lt;boost/assert.hpp&gt;</STRONG> defines the macro <b>BOOST_ASSERT</b>, 
			which is similar to the standard <STRONG>assert</STRONG> macro defined in <STRONG>&lt;cassert&gt;</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>&lt;boost/assert.hpp&gt;</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>&lt;boost/assert.hpp&gt;</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>&lt;boost/assert.hpp&gt;</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>&lt;cassert&gt;</STRONG>, <STRONG>&lt;boost/assert.hpp&gt;</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><STRONG>&lt;boost/assert.hpp&gt;</STRONG> also defines the macro <STRONG>BOOST_VERIFY</STRONG>. 
			It has exactly the same behavior as <STRONG>BOOST_ASSERT</STRONG>, except that 
			the expression that is passed to <STRONG>BOOST_VERIFY</STRONG> is always 
			evaluated. This is useful when the asserted expression has desirable side 
			effects; it can also help suppress warnings about unused variables when the 
			only use of the variable is inside an assertion.</p>
		<p><br>
			<small>Copyright  2002, 2007 by Peter Dimov. Distributed under the Boost Software 
				License, Version 1.0. See accompanying file <A href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</A>
				or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>.</small></p>
	</body>
</html>