22 lines
580 B
C
22 lines
580 B
C
#ifndef DYNAMIC_PROGRAM_MYASSERT_H
|
|
#define DYNAMIC_PROGRAM_MYASSERT_H
|
|
|
|
/**
|
|
* @file myassert.h
|
|
* This is essentially like the default assert header, but we additionally
|
|
* dummy-use the expression in case NDEBUG is defined.
|
|
* This ensures that we do not get compiler warnings for variables that are solely
|
|
* used in assertions.
|
|
* If there are such variables, they will be optimized out in opt-mode anyway.
|
|
*/
|
|
|
|
#ifdef NDEBUG
|
|
#define ASSERT(x) do { (void)sizeof(x);} while (0)
|
|
#else
|
|
|
|
#include <assert.h>
|
|
|
|
#define ASSERT(x) assert(x)
|
|
#endif
|
|
|
|
#endif //DYNAMIC_PROGRAM_MYASSERT_H
|