blob: 2c63b56302650a95fbee34087073fb033a69d40f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
/* People have been abusing assert by assuming it will always execute. To
* rememdy the situation, asserts were replaced with CHECK. These should then
* be manually replaced with assert (when used correctly) or UTIL_THROW (for
* runtime checks).
*/
#ifndef UTIL_CHECK__
#define UTIL_CHECK__
#include <stdlib.h>
#include <iostream>
#include <cassert>
#define CHECK(Condition) do { \
if (!(Condition)) { \
std::cerr << "Check " << #Condition << " failed in " << __FILE__ << ":" << __LINE__ << std::endl; \
abort(); \
} \
} while (0) // swallow ;
#endif // UTIL_CHECK__
|