assert.h 712 B

12345678910111213141516171819
  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. /* $Id$ */
  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 _ASSERT_H
  8. #define _ASSERT_H
  9. #ifndef NDEBUG
  10. /* Note: this macro uses parameter substitution inside strings */
  11. #define assert(exp) (exp || (fprintf(stderr,"Assertion \"%s\" failed: file %s, line %d\n", "exp", __FILE__, __LINE__), exit(1)))
  12. #define _assert(exp) (exp || (fprintf(stderr,"Assertion \"%s\" failed: file %s, line %d\n", "exp", __FILE__, __LINE__), exit(1)))
  13. #else
  14. #define assert(exp) (1)
  15. #define _assert(exp) (1)
  16. #endif /* NDEBUG */
  17. #endif /* _ASSERT_H */