assert(3)


NAME

   assert - abort the program if assertion is false

SYNOPSIS

   #include <assert.h>

   void assert(scalar expression);

DESCRIPTION

   This  macro can help programmers find bugs in their programs, or handle
   exceptional cases via a  crash  that  will  produce  limited  debugging
   output.

   If  expression is false (i.e., compares equal to zero), assert() prints
   an error message to  standard  error  and  terminates  the  program  by
   calling  abort(3).  The error message includes the name of the file and
   function containing the assert() call, the source code line  number  of
   the call, and the text of the argument; something like:

       prog: some_file.c:16: some_func: Assertion `val == 0' failed.

   If  the  macro  NDEBUG  is  defined  at  the moment <assert.h> was last
   included, the macro assert() generates no code, and hence does  nothing
   at  all.   It  is not recommended to define NDEBUG if using assert() to
   detect  error  conditions  since   the   software   may   behave   non-
   deterministically.

RETURN VALUE

   No value is returned.

ATTRIBUTES

   For   an   explanation   of   the  terms  used  in  this  section,  see
   attributes(7).

   
   Interface  Attribute      Value   
   
   assert()   Thread safety  MT-Safe 
   

CONFORMING TO

   POSIX.1-2001, POSIX.1-2008, C89, C99.  In C89, expression  is  required
   to  be  of type int and undefined behavior results if it is not, but in
   C99 it may have any scalar type.

BUGS

   assert() is implemented as a macro; if the expression tested has  side-
   effects, program behavior will be different depending on whether NDEBUG
   is defined.  This may create Heisenbugs which go away when debugging is
   turned on.

SEE ALSO

   abort(3), assert_perror(3), exit(3)

COLOPHON

   This  page  is  part of release 4.09 of the Linux man-pages project.  A
   description of the project, information about reporting bugs,  and  the
   latest     version     of     this    page,    can    be    found    at
   https://www.kernel.org/doc/man-pages/.


More Linux Commands

manpages/XtInstallAccelerators.3.html
XtInstallAccelerators(3) - managing accelerator tables......
The XtParseAcceleratorTable function compiles the accelerator table into the opaque internal representation. The XtInstallAccelerators function installs the acc

manpages/gnutls_x509_crt_init.3.html
gnutls_x509_crt_init(3) - API function - Linux manual page
This function will initialize an X.509 certificate structure. RETURNS On success, GNUTLS_E_SUCCESS (0) is returned, otherwise a negative error value. REPORTING

manpages/ttk_panedwindow.n.html
ttk_panedwindow(n) Multi-pane container window (Man Page)...
A ttk::panedwindow widget displays a number of subwindows, stacked either vertically or horizontally. The user may adjust the relative sizes of the subwindows b

manpages/XML::DOM::Entity.3pm.html
XML::DOM::Entity(3pm) - An XML ENTITY in XML::DOM (ManPage)
XML::DOM::Entity extends XML::DOM::Node. This node represents an Entity declaration, e.g. &lt;!ENTITY % draft INCLUDE&gt; &lt;!ENTITY hatch-pic SYSTEM ../grafix/OpenHatc

manpages/rlatopam.1.html
rlatopam(1) - convert Alias/Wavefront RLA and RPF image file
This program is part of Netpbm(1) rlatopam converts an Alias RLA (run-length encoded type A) or RPF (rich pixel format) image to a PAM image file. The output PA

manpages/ldap_next_message.3.html
ldap_next_message(3) - Stepping through messages in a result
These routines are used to step through the messages in a result chain received from ldap_result(3). For search operations, the result chain can contain referra

manpages/systemd-initctl.8.html
systemd-initctl(8) dev initctl compatibility (Man Page).....
systemd-initctl is a system service that implements compatibility with the /dev/initctl FIFO file system object, as implemented by the SysV init system. systemd

manpages/Test::Builder::Module.3pm.html
Test::Builder::Module(3pm) - Base class for test modules....
This is a superclass for Test::Builder-based modules. It provides a handful of common functionality and a method of getting at the underlying Test::Builder obje

manpages/gluPwlCurve.3gl.html
gluPwlCurve(3gl) - describe a piecewise linear NURBS trimmin
gluPwlCurve describes a piecewise linear trimming curve for a NURBS surface. A piecewise linear curve consists of a list of coordinates of points in the paramet

manpages/glVertex2dv.3gl.html
glVertex2dv(3gl) - specify a vertex - Linux manual page.....
glVertex commands are used within glBegin/glEnd pairs to specify point, line, and polygon vertices. The current color, normal, and texture coordinates are assoc

manpages/grab.n.html
grab(n) - Confine pointer and keyboard events to a window su
This command implements simple pointer and keyboard grabs for Tk. Tks grabs are different than the grabs described in the Xlib documentation. When a grab is set

manpages/Tcl_Chdir.3.html
Tcl_Chdir(3) - manipulate the current working directory.....
These procedures may be used to manipulate the current working directory for the application. They provide C-level access to the same functionality as the Tcl p





We can't live, work or learn in freedom unless the software we use is free.