assert.h 650 B

123456789101112131415
  1. /*
  2. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  3. * See the copyright notice in the ACK home directory, in the file "Copyright".
  4. */
  5. /* $Header$ */
  6. /* A S S E R T I O N M A C R O D E F I N I T I O N */
  7. #ifndef NDEBUG
  8. /* Note: this macro uses parameter substitution inside strings */
  9. #define assert(exp) (exp || (fprintf(stderr,"Assertion \"%s\" failed: file %s, line %d\n", "exp", __FILE__, __LINE__), exit(1)))
  10. #define _assert(exp) (exp || (fprintf(stderr,"Assertion \"%s\" failed: file %s, line %d\n", "exp", __FILE__, __LINE__), exit(1)))
  11. #else
  12. #define assert(exp) (1)
  13. #define _assert(exp) (1)
  14. #endif NDEBUG