home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / language / fixes / assert.h next >
Encoding:
C/C++ Source or Header  |  1985-11-19  |  483 b   |  27 lines

  1. #ifndef ASSERT_H
  2. #define    ASSERT_H
  3.  
  4. #ifdef NDEBUG
  5.  
  6. #define    assert(cond)
  7.  
  8. #else
  9.  
  10. #ifdef __LINE__
  11.  
  12. static char __AssertFmt[] = "assert failed in '%s' at line %d.\n";
  13. #define    assert(cond)    if(!(cond)) \
  14.  { fprintf(stderr, __AssertFmt, __FILE__, __LINE__); exit(-1); } else
  15.  
  16. #else
  17.  
  18. static char __AssertMsg[] = "assert failure!\n";
  19. #define    assert(cond)    if(!(cond)) \
  20.  { fputs(__AssertMsg, stderr); exit(-1); } else
  21.  
  22. #endif __LINE__
  23.  
  24. #endif NDEBUG
  25.  
  26. #endif ASSERT_H
  27.