improved assert macro
This commit is contained in:
parent
a0aa85fa4e
commit
8005ef1672
|
@ -7,10 +7,10 @@
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#ifdef __STDC__
|
#ifdef __STDC__
|
||||||
#define assert(exp) (exp || _BadAssertion(__FILE__, __LINE__, #exp))
|
#define assert(exp) ((exp) || _BadAssertion(__FILE__, __LINE__, #exp))
|
||||||
#else
|
#else
|
||||||
/* Note: this macro uses parameter substitution inside strings */
|
/* Note: this macro uses parameter substitution inside strings */
|
||||||
#define assert(exp) (exp || _BadAssertion(__FILE__, __LINE__, "exp"))
|
#define assert(exp) ((exp) || _BadAssertion(__FILE__, __LINE__, "exp"))
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#define assert(exp) (1)
|
#define assert(exp) (1)
|
||||||
|
|
Loading…
Reference in a new issue