Skip to content

Instantly share code, notes, and snippets.

@jmbr
Created August 30, 2013 17:56
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 jmbr/6392564 to your computer and use it in GitHub Desktop.
Save jmbr/6392564 to your computer and use it in GitHub Desktop.
Unlike the assert() macro, abort_unless() is not disabled by defining the preprocessor macro NDEBUG.
#define abort_unless(expr) do { \
if (!(expr)) { \
fprintf(stderr, "%s:%u (%s): Assertion `%s' failed.\n", \
__FILE__, __LINE__, __func__, __STRING(expr)); \
fflush(stderr); \
abort(); \
} \
} while (0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment