changed assert macro to also work with ANSI C compilers

This commit is contained in:
ceriel 1988-10-21 17:34:20 +00:00
parent 416020b5bd
commit 0d9daaa18d

View file

@ -7,7 +7,11 @@
#ifdef DEBUG #ifdef DEBUG
/* Note: this macro uses parameter substitution inside strings */ /* Note: this macro uses parameter substitution inside strings */
#ifdef __STDC__
#define assert(exp) (exp || _BadAssertion(__FILE__, __LINE__, #exp))
#else
#define assert(exp) (exp || _BadAssertion(__FILE__, __LINE__, "exp")) #define assert(exp) (exp || _BadAssertion(__FILE__, __LINE__, "exp"))
#endif
#else #else
#define assert(exp) (1) #define assert(exp) (1)
#endif DEBUG #endif DEBUG