home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.0 / NeXTSTEP3.0.iso / NextDeveloper / Headers / ansi / assert.h < prev    next >
Text File  |  1992-01-08  |  717b  |  32 lines

  1. /*    assert.h    4.2    85/01/21    */
  2.  
  3. /* Copyright (c) 1988 NeXT, Inc. - 9/13/88 CCH */
  4.  
  5. #ifndef _ASSERT_H
  6. #define _ASSERT_H
  7.  
  8. #ifdef __STRICT_BSD__
  9. extern void abort(void);
  10. #else
  11. #import <stdio.h>
  12. #import <stdlib.h>
  13. #endif /* __STRICT_BSD__ */
  14.  
  15. /* for BSD compatibility */
  16. #define _assert(x) assert(x)
  17. #endif /* _ASSERT_H */
  18.  
  19. /* placed outside so can be multiply included after a #define or #undef
  20.  * NDEBUG to turn assertion checking on and off within a compile */
  21. #undef assert
  22.  
  23. #ifdef NDEBUG
  24. #define assert(ignore) ((void)0)
  25. #else
  26. #define assert(expression) \
  27.   ((expression) ? (void) 0 : \
  28.    (fprintf (stderr, "Assertion failed: " #expression \
  29.       ", file " __FILE__ ", line %d.\n", __LINE__), \
  30.     abort ()))
  31. #endif
  32.