Tweaks and fixes for Assert

This commit is contained in:
Deukhoofd committed 2020-03-22 12:20:39 +01:00
1 parent 638a414961
commit e07e07253d
3 files changed
+14 -14

No files matched your search

+7 -7
View File
@@ -6,15 +6,15 @@
#ifndef NO_ASSERT
#define Assert(expr) \
if (!(expr)) { \
std::stringstream ss; \
ss << "ASSERTION FAILED: [" << __FILENAME__ << " (" << __LINE__ << ")] \""; \
ss << #expr << "\""; \
throw std::logic_error(ss.str()); \
if (!(expr)) { \
std::stringstream ss; \
ss << "ASSERTION FAILED: [" << __FILENAME__ << " (" << __LINE__ << ")] \""; \
ss << #expr << "\""; \
throw std::logic_error(ss.str()); \
}
#else
// Assert is empty if NO_ASSERT is defined.
#define Assert(expr)
#define Assert(expr) ;
#endif
#define AssertNotNull(value) Assert(value != nullptr);
#define AssertNotNull(value) Assert(value != nullptr)