home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / assert.h < prev    next >
C/C++ Source or Header  |  1998-06-16  |  1KB  |  69 lines

  1. /***
  2. *assert.h - define the assert macro
  3. *
  4. *       Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. *       Defines the assert(exp) macro.
  8. *       [ANSI/System V]
  9. *
  10. *       [Public]
  11. *
  12. ****/
  13.  
  14. #if     !defined(_WIN32) && !defined(_MAC)
  15. #error ERROR: Only Mac or Win32 targets supported!
  16. #endif
  17.  
  18.  
  19.  
  20.  
  21. /* Define _CRTIMP */
  22.  
  23. #ifndef _CRTIMP
  24. #ifdef  _DLL
  25. #define _CRTIMP __declspec(dllimport)
  26. #else   /* ndef _DLL */
  27. #define _CRTIMP
  28. #endif  /* _DLL */
  29. #endif  /* _CRTIMP */
  30.  
  31.  
  32. /* Define __cdecl for non-Microsoft compilers */
  33.  
  34. #if     ( !defined(_MSC_VER) && !defined(__cdecl) )
  35. #define __cdecl
  36. #endif
  37.  
  38. /* Define _CRTAPI1 (for compatibility with the NT SDK) */
  39.  
  40. #ifndef _CRTAPI1
  41. #if    _MSC_VER >= 800 && _M_IX86 >= 300
  42. #define _CRTAPI1 __cdecl
  43. #else
  44. #define _CRTAPI1
  45. #endif
  46. #endif
  47.  
  48. #undef  assert
  49.  
  50. #ifdef  NDEBUG
  51.  
  52. #define assert(exp)     ((void)0)
  53.  
  54. #else
  55.  
  56. #ifdef  __cplusplus
  57. extern "C" {
  58. #endif
  59.  
  60. _CRTIMP void __cdecl _assert(void *, void *, unsigned);
  61.  
  62. #ifdef  __cplusplus
  63. }
  64. #endif
  65.  
  66. #define assert(exp) (void)( (exp) || (_assert(#exp, __FILE__, __LINE__), 0) )
  67.  
  68. #endif  /* NDEBUG */
  69.