#ifndef __MY_ASSERT_H__ #define __MY_ASSERT_H__ #include #include #include "log.h" // assert also writes to a log. Assert is intended to be compiled // regardless of whether macro NDEBUG is defined or not #define assert(cond) \ do { \ if (! (cond)) { \ if (plog) { \ plog->alarm ("Assertion failed: `%s'\nat `%s' line `%d'\n", \ #cond, __FILE__, __LINE__); \ } \ else { \ std::fprintf (stderr, "Assertion failed: `%s'\nat `%s' line `%d'\n", \ #cond, __FILE__, __LINE__); \ } \ std::abort (); \ } \ } while (0) #endif .