X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=includes%2Fassert.h;h=ebf4d8c15b4eac6224415223754ba50459264ebd;hb=f72e1f3e6441674c8ad2ab620102e50b3bf53768;hp=e4363f510f42ad4768d35ed28cd523452da61fa8;hpb=1e221deb9ee725a14b3656f94e2763f8faeb18dc;p=pdclib diff --git a/includes/assert.h b/includes/assert.h index e4363f5..ebf4d8c 100644 --- a/includes/assert.h +++ b/includes/assert.h @@ -4,7 +4,7 @@ // Public Domain C Library - http://pdclib.sourceforge.net // This code is Public Domain. Use, modify, and redistribute at will. // ---------------------------------------------------------------------------- -// Provides the debug macro assert(). +// Diagnostics // ---------------------------------------------------------------------------- #ifndef __ASSERT_H @@ -22,16 +22,13 @@ void __assert( char const * const expression, // the tested expression // ---------------------------------------------------------------------------- // DEFINES -// TODO: is given as (void) 0, which might give a "C style -// cast" warning under C++. Find a void expression that does not give warnings. - // TODO: Check the macro for if-compatibility. #undef assert #if defined NDEBUG -#define assert( x ) +#define assert( x ) ( (void) 0 ) #else -#define assert( x ) ( x ) ? \ +#define assert( x ) ( x ) ? ( (void) 0 ) \ : __assert( #x, __FILE__, __func__, __LINE__ ) #endif