home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / BRIK.ZIP / ASSERT.H < prev    next >
C/C++ Source or Header  |  1989-03-09  |  754b  |  29 lines

  1. /* @(#) assert.h 1.5 89/03/08 14:59:02 */
  2.  
  3. /* I claim no copyright over the contents of this file.  -- Rahul Dhesi */
  4.  
  5. /*
  6. Checksum: 3376323427      (check or update this with "brik")
  7. */
  8.  
  9. /*
  10. **   Assertions are enabled only if NDEBUG is not defined.
  11. **   Not all compilers define __FILE__ and __LINE__.  If yours
  12. **   doesn't, you can just let NDEBUG remain #defined in brik.h and no
  13. **   assertions will be compiled in.  Or, if you want to enable
  14. **   assertions, redefine the assert() macro so it works with your
  15. **   compiler.
  16. */
  17.  
  18. #ifndef OK_STDIO
  19. # include <stdio.h>
  20. # define OK_STDIO
  21. #endif
  22.  
  23. #ifndef NDEBUG
  24. #define assert(E) \
  25. {if(!(E))fprintf(stderr,"Assertion error in %s line %d\n",__FILE__,__LINE__);}
  26. #else
  27. #define assert(E)
  28. #endif /* NDEBUG */
  29.