Don't evaluate MESSAGE twice in FAIL_M. Reduces the code

cost of assertions.
This commit is contained in:
Glenn Maynard
2005-12-30 08:01:47 +00:00
parent 000a896258
commit 79c00ae191
+1 -1
View File
@@ -99,7 +99,7 @@ void NORETURN sm_crash( const char *reason = "Internal error" );
* we get a backtrace. This should probably be used instead of throwing an
* exception in most cases we expect never to happen (but not in cases that
* we do expect, such as DSound init failure.) */
#define FAIL_M(MESSAGE) { CHECKPOINT_M(MESSAGE); sm_crash(MESSAGE); }
#define FAIL_M(MESSAGE) { const char *pStr = (MESSAGE); CHECKPOINT_M(pStr); sm_crash(pStr); }
#define ASSERT_M(COND, MESSAGE) { if(unlikely(!(COND))) { FAIL_M(MESSAGE); } }
#if !defined(CO_EXIST_WITH_MFC)
#define ASSERT(COND) ASSERT_M((COND), "Assertion '" #COND "' failed")