<cassert>
Home Up

 

Same level pages:
<algorithms>
<cassert>
<cerrno>
<cctype>
<cfloat>
<climits>
<clocale>
<cmath>
<complex>
<csetjmp>
<csignal>
<cstdarg>
<cstddef>
<cstdio>
<cstdlib>
<cstring>
<ctime>
<cwchar>
<cwctype>
<exception>
<fstream>
<functional>
<iomanip>
<ios>
<iostream>
<istream>
<iterator>
<limits>
<locale>
<memory>
<new>
<numeric>
<ostream>
<sstream>
<stdexcept>
<streambuf>
<string>
<typeinfo>
<utility>
<valarray>

Parent level pages:
STL
FAQs
Headers
Libraries

<cassert> is part of the diagnostics library.

Macros

assert ( expression )
If expression is false , assert() prints something like:

Assertion failed: expression, file xyz, line nnn


on the standard error output and aborts. In the error message, xyz is the name of the source file and nnn the source line number of the assert() statement. The latter are respectively the values of the preprocessor macros __FILE__ and __LINE__.
 
Compiling with the macro NDEBUG defined ahead of the #include <assert> statement, will stop assertions from being compiled into the program.
 
ŠPaul Buis & Ball State University Author: Paul Buis (peb@bsu.edu) Last Modified:10/31/00 05:01 PM

NOTICE: The information presented on this page represents the personal views, ideas, and opinions of the author. This is not an official Ball State University web page. Links contained at this web site to other organizations, are presented as a service and neither constitute nor imply university endorsement or warranty.