Skip to content

Instantly share code, notes, and snippets.

@awreece
Last active December 29, 2015 06:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save awreece/7629881 to your computer and use it in GitHub Desktop.
Save awreece/7629881 to your computer and use it in GitHub Desktop.
#define CHECK(value, op, expected) \
do { \
__typeof__(value) _val = value; \
__typeof__(expected) _exp = expected; \
if (!(_val op _exp) { \
fprintf(stderr, "Assertion failure on %s:%d: " \
"expected " #value "(0x%x)" #op \
#expected "(0x%x)", \
__FILE__, __LINE__, _val, _exp); \
abort(); \
} \
} while(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment