You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
436 B
C
26 lines
436 B
C
#include <stdio.h>
|
|
|
|
#ifdef WEB
|
|
#include <assert.h>
|
|
#endif
|
|
|
|
static inline void assert_impl(bool cond, const char *expression)
|
|
{
|
|
if(!cond)
|
|
{
|
|
fprintf(stderr, "Assertion failed: %s\n", expression);
|
|
#ifdef WEB
|
|
assert(false);
|
|
#elif defined(DESKTOP)
|
|
__debugbreak();
|
|
#else
|
|
#error "Don't know how to assert for current platform configuration"
|
|
#endif
|
|
}
|
|
}
|
|
#ifdef assert
|
|
#undef assert
|
|
#endif
|
|
|
|
#define assert(cond) assert_impl(cond, #cond)
|