The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/include/assert.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /* The <assert.h> header contains a macro called "assert" that allows 
    2  * programmers to put assertions in the code.  These assertions can be verified
    3  * at run time.  If an assertion fails, an error message is printed and the
    4  * program aborts.
    5  * Assertion checking can be disabled by adding the statement
    6  *
    7  *      #define NDEBUG
    8  *
    9  * to the program before the 
   10  *
   11  *      #include <assert.h>
   12  *
   13  * statement.
   14  */
   15 
   16 #undef assert
   17 
   18 #ifndef _ANSI_H
   19 #include <ansi.h>
   20 #endif
   21 
   22 #ifdef NDEBUG
   23 /* Debugging disabled -- do not evaluate assertions. */
   24 #define assert(expr)  ((void) 0)
   25 #else
   26 /* Debugging enabled -- verify assertions at run time. */
   27 #ifdef _ANSI
   28 #define __str(x)        # x
   29 #define __xstr(x)       __str(x)
   30 
   31 _PROTOTYPE( void __bad_assertion, (const char *_mess) );
   32 #define assert(expr)    ((expr)? (void)0 : \
   33                                 __bad_assertion("Assertion \"" #expr \
   34                                     "\" failed, file " __xstr(__FILE__) \
   35                                     ", line " __xstr(__LINE__) "\n"))
   36 #else
   37 #define assert(expr) ((void) ((expr) ? 0 : __assert( __FILE__,  __LINE__)))
   38 #endif /* _ANSI */
   39 #endif

Cache object: 53437bb9ca80788be388e3aaca6968ee


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.