Created
August 8, 2017 22:14
-
-
Save anonymous/14c7a58912b74c6511e3c1377510a060 to your computer and use it in GitHub Desktop.
assert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define DEBUGBREAK() __ud2() | |
#ifdef NDEBUG | |
#define ASSERT(x) __assume(x) | |
#define ASSERT_IF(cond, x) | |
#define ASSERT_IFF(cond, x) | |
#define ASSERT_IF_ELSE(cond, x, y) | |
#define ASSERTED_EXPRIF(x, t, f) ( (x) ? (t) : (f) ) | |
#else | |
#define ASSERT(x) do { if(!(x)) DEBUGBREAK(); } while(0) | |
#define ASSERT_IF(cond, x) do { if(cond) if(!(x)) DEBUGBREAK(); } while(0) | |
#define ASSERT_IFF(cond, x) do { if(cond) { if(!(x)) DEBUGBREAK(); } else { if(x) DEBUGBREAK(); } } while(0) | |
#define ASSERT_IF_ELSE(cond, x, y) do { if(cond) { if(!(x)) DEBUGBREAK(); } else { if(!(y)) DEBUGBREAK(); } } while(0) | |
#define ASSERTED_EXPRIF(x, t, f) ( (x) ? (t) : DEBUGBREAK(),(f) ) | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment