1 // ----------------------------------------------------------------------------
3 // ----------------------------------------------------------------------------
4 // Public Domain C Library - http://pdclib.sourceforge.net
5 // This code is Public Domain. Use, modify, and redistribute at will.
6 // ----------------------------------------------------------------------------
8 // ----------------------------------------------------------------------------
11 #define __ASSERT_H __ASSERT_H
13 // ----------------------------------------------------------------------------
16 // Helper function doing the print to stderr and call to abort().
17 void __assert( char const * const expression, // the tested expression
18 char const * const file, // name of source file
19 char const * const function, // name of function
20 int const line ); // number of source file line
22 // ----------------------------------------------------------------------------
25 // TODO: Check the macro for if-compatibility.
29 #define assert( x ) ( (void) 0 )
31 #define assert( x ) ( x ) ? ( (void) 0 ) \
32 : __assert( #x, __FILE__, __func__, __LINE__ )