util.h 254 B

1234567891011121314
  1. #ifndef UTIL_H
  2. #define UTIL_H
  3. #define ABORT(x) do { \
  4. fprintf(stderr, "aborted at %s:%i: %s\n", __FILE__, __LINE__, x); \
  5. exit(1); } while(0)
  6. #define ASSERT(b, err) do { \
  7. if (!(b)) \
  8. { ABORT("assert_failed: " err); \
  9. }; \
  10. } while(0)
  11. #endif