diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/Globals.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/source/Globals.h b/source/Globals.h index c2aa3753c..592580153 100644 --- a/source/Globals.h +++ b/source/Globals.h @@ -120,7 +120,15 @@ /// Faster than (int)floorf((float)x / (float)div)
#define FAST_FLOOR_DIV( x, div ) ( (x) < 0 ? (((int)x / div) - 1) : ((int)x / div) )
-#define ASSERT( x ) { if( !(x) ) { LOGERROR("Assertion failed: \"%s\", file %s, line %i", #x, __FILE__, __LINE__ ); assert( !#x ); } }
+// Own version of assert() that writes failed assertions to the log for review
+#ifdef NDEBUG
+ #define ASSERT(x) ((void)0)
+#else
+ #define ASSERT( x ) ( !!(x) || ( LOGERROR("Assertion failed: %s, file %s, line %i", #x, __FILE__, __LINE__ ), assert(0), 0 ) )
+#endif
+
+// Pretty much the same as ASSERT() but stays in Release builds
+#define VERIFY( x ) ( !!(x) || ( LOGERROR("Verification failed: %s, file %s, line %i", #x, __FILE__, __LINE__ ), exit(1), 0 ) )
|