home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 2.ddi / CLASSINC.ZIP / CHECKS.H < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  1.8 KB  |  57 lines

  1. /*------------------------------------------------------------------------*/
  2. /*                                                                        */
  3. /*  CHECKS.H                                                              */
  4. /*                                                                        */
  5. /*  Copyright Borland International 1991, 1992                            */
  6. /*  All Rights Reserved                                                   */
  7. /*                                                                        */
  8. /*------------------------------------------------------------------------*/
  9.  
  10. #if !defined( __CHECKS_H )
  11. #define __CHECKS_H
  12.  
  13. #if !defined( __DEFS_H )
  14. #include <_defs.h>
  15. #endif  // __DEFS_H
  16.  
  17. #pragma option -Vo-
  18. #if defined( __BCOPT__ ) && !defined( _ALLOW_po )
  19. #pragma option -po-
  20. #endif
  21.  
  22. extern "C" void _Cdecl __assertfail( char _FAR *__msg,
  23.                                      char _FAR *__cond,
  24.                                      char _FAR *__file,
  25.                                      int __line);
  26.  
  27. #if !defined( __DEBUG )
  28. #define __DEBUG 2
  29. #endif
  30.  
  31. #undef PRECONDITION
  32.  
  33. #if __DEBUG < 1
  34. #define PRECONDITION(p)   ((void)0)
  35. #else
  36. #define PRECONDITION(p)   ((p) ? (void)0 : (void) __assertfail(      \
  37.                     "Precondition violated: %s, file %s, line %d\n", \
  38.                     #p, __FILE__, __LINE__ ) )
  39. #endif
  40.  
  41. #undef CHECK
  42.  
  43. #if __DEBUG < 2
  44. #define CHECK(p)    ((void)0)
  45. #else
  46. #define CHECK(p)    ((p) ? (void)0 : (void) __assertfail(   \
  47.                     "Check failed: %s, file %s, line %d\n", \
  48.                     #p, __FILE__, __LINE__ ) )
  49. #endif
  50.  
  51. #if defined( __BCOPT__ ) && !defined( _ALLOW_po )
  52. #pragma option -po.
  53. #endif
  54. #pragma option -Vo.
  55.  
  56. #endif  // __CHECKS_H
  57.