home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 May / Pcwk5b98.iso / Borland / Cplus45 / BC45 / INC.PAK / ASSERT.H < prev    next >
C/C++ Source or Header  |  1995-08-29  |  2KB  |  97 lines

  1. /*  assert.h
  2.  
  3.     assert macro
  4.  
  5. */
  6.  
  7. /*
  8.  *      C/C++ Run Time Library - Version 6.5
  9.  *
  10.  *      Copyright (c) 1987, 1994 by Borland International
  11.  *      All Rights Reserved.
  12.  *
  13.  */
  14.  
  15.  
  16. #if !defined(___DEFS_H)
  17. #include <_defs.h>
  18. #endif
  19.  
  20.  
  21. #if !defined(RC_INVOKED)
  22.  
  23. #if defined(__STDC__)
  24. #pragma warn -nak
  25. #endif
  26.  
  27. #endif  /* !RC_INVOKED */
  28.  
  29.  
  30. #if !defined(__FLAT__)
  31.  
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35.  
  36. void _Cdecl _FARFUNC __assertfail( char _FAR *__msg,
  37.                                    char _FAR *__cond,
  38.                                    char _FAR *__file,
  39.                                    int __line);
  40.  
  41. #ifdef  __cplusplus
  42. }
  43. #endif
  44.  
  45. #undef assert
  46.  
  47. #ifdef NDEBUG
  48. #  define assert(p)   ((void)0)
  49. #else
  50. #  if defined(_Windows) && !defined(__DPMI16__)
  51. #    define _ENDL
  52. #  else
  53. #    define _ENDL "\n"
  54. #  endif
  55. #  define assert(p) ((p) ? (void)0 : (void) __assertfail( \
  56.                     "Assertion failed: %s, file %s, line %d" _ENDL, \
  57.                     #p, __FILE__, __LINE__ ) )
  58. #endif
  59.  
  60. #else  /* defined __FLAT__ */
  61.  
  62. #ifdef __cplusplus
  63. extern "C" {
  64. #endif
  65.  
  66. void _RTLENTRY _EXPFUNC _assert(char * __cond, char * __file, int __line);
  67.  
  68. /* Obsolete interface: __msg should be "Assertion failed: %s, file %s, line %d"
  69.  */
  70. void _RTLENTRY _EXPFUNC __assertfail(char * __msg, char * __cond,
  71.                                      char * __file, int __line);
  72.  
  73. #ifdef  __cplusplus
  74. }                                  
  75. #endif
  76.  
  77. #undef assert
  78.  
  79. #ifdef NDEBUG
  80. #define assert(p)   ((void)0)
  81. #else
  82. #define assert(p)   ((p) ? (void)0 : _assert(#p, __FILE__, __LINE__))
  83. #endif
  84.  
  85.  
  86. #endif  /* __FLAT__  */
  87.  
  88.  
  89. #if !defined(RC_INVOKED)
  90.  
  91. #if defined(__STDC__)
  92. #pragma warn .nak
  93. #endif
  94.  
  95. #endif  /* !RC_INVOKED */
  96.  
  97.