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

  1. /***
  2. *stddef.h - definitions/declarations for common constants, types, variables
  3. *
  4. *       Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. *       This file contains definitions and declarations for some commonly
  8. *       used constants, types, and variables.
  9. *       [ANSI]
  10. *
  11. *       [Public]
  12. *
  13. ****/
  14.  
  15. #if     _MSC_VER > 1000
  16. #pragma once
  17. #endif
  18.  
  19. #ifndef _INC_STDDEF
  20. #define _INC_STDDEF
  21.  
  22. #if     !defined(_WIN32) && !defined(_MAC)
  23. #error ERROR: Only Mac or Win32 targets supported!
  24. #endif
  25.  
  26.  
  27. #ifdef  __cplusplus
  28. extern "C" {
  29. #endif
  30.  
  31.  
  32.  
  33. /* Define _CRTIMP */
  34.  
  35. #ifndef _CRTIMP
  36. #ifdef  _DLL
  37. #define _CRTIMP __declspec(dllimport)
  38. #else   /* ndef _DLL */
  39. #define _CRTIMP
  40. #endif  /* _DLL */
  41. #endif  /* _CRTIMP */
  42.  
  43. /* Define __cdecl for non-Microsoft compilers */
  44.  
  45. #if     ( !defined(_MSC_VER) && !defined(__cdecl) )
  46. #define __cdecl
  47. #endif
  48.  
  49. /* Define _CRTAPI1 (for compatibility with the NT SDK) */
  50.  
  51. #ifndef _CRTAPI1
  52. #if    _MSC_VER >= 800 && _M_IX86 >= 300
  53. #define _CRTAPI1 __cdecl
  54. #else
  55. #define _CRTAPI1
  56. #endif
  57. #endif
  58.  
  59.  
  60. /* Define NULL pointer value and the offset() macro */
  61.  
  62. #ifndef NULL
  63. #ifdef  __cplusplus
  64. #define NULL    0
  65. #else
  66. #define NULL    ((void *)0)
  67. #endif
  68. #endif
  69.  
  70.  
  71. #define offsetof(s,m)   (size_t)&(((s *)0)->m)
  72.  
  73.  
  74. /* Declare reference to errno */
  75.  
  76. #if     (defined(_MT) || defined(_DLL)) && !defined(_MAC)
  77. _CRTIMP extern int * __cdecl _errno(void);
  78. #define errno   (*_errno())
  79. #else   /* ndef _MT && ndef _DLL */
  80. _CRTIMP extern int errno;
  81. #endif  /* _MT || _DLL */
  82.  
  83.  
  84. /* define the implementation dependent size types */
  85.  
  86. #ifndef _PTRDIFF_T_DEFINED
  87. typedef int ptrdiff_t;
  88. #define _PTRDIFF_T_DEFINED
  89. #endif
  90.  
  91.  
  92. #ifndef _SIZE_T_DEFINED
  93. typedef unsigned int size_t;
  94. #define _SIZE_T_DEFINED
  95. #endif
  96.  
  97.  
  98. #ifndef _WCHAR_T_DEFINED
  99. typedef unsigned short wchar_t;
  100. #define _WCHAR_T_DEFINED
  101. #endif
  102.  
  103.  
  104. #ifdef  _MT
  105. _CRTIMP extern unsigned long  __cdecl __threadid(void);
  106. #define _threadid       (__threadid())
  107. _CRTIMP extern unsigned long  __cdecl __threadhandle(void);
  108. #endif
  109.  
  110.  
  111. #ifdef  __cplusplus
  112. }
  113. #endif
  114.  
  115. #endif  /* _INC_STDDEF */
  116.