home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / crt / src / stddef.h < prev    next >
C/C++ Source or Header  |  1998-06-17  |  3KB  |  130 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  /* _MSC_VER > 1000 */
  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  /* !defined (_WIN32) && !defined (_MAC) */
  25.  
  26. #ifndef _CRTBLD
  27. /* This version of the header files is NOT for user programs.
  28.  * It is intended for use when building the C runtimes ONLY.
  29.  * The version intended for public use will not have this message.
  30.  */
  31. #error ERROR: Use of C runtime library internal header file.
  32. #endif  /* _CRTBLD */
  33.  
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif  /* __cplusplus */
  37.  
  38. #ifndef _INTERNAL_IFSTRIP_
  39. #include <cruntime.h>
  40. #endif  /* _INTERNAL_IFSTRIP_ */
  41.  
  42.  
  43. /* Define _CRTIMP */
  44.  
  45. #ifndef _CRTIMP
  46. #ifdef CRTDLL
  47. #define _CRTIMP __declspec(dllexport)
  48. #else  /* CRTDLL */
  49. #ifdef _DLL
  50. #define _CRTIMP __declspec(dllimport)
  51. #else  /* _DLL */
  52. #define _CRTIMP
  53. #endif  /* _DLL */
  54. #endif  /* CRTDLL */
  55. #endif  /* _CRTIMP */
  56.  
  57. /* Define __cdecl for non-Microsoft compilers */
  58.  
  59. #if (!defined (_MSC_VER) && !defined (__cdecl))
  60. #define __cdecl
  61. #endif  /* (!defined (_MSC_VER) && !defined (__cdecl)) */
  62.  
  63. /* Define _CRTAPI1 (for compatibility with the NT SDK) */
  64.  
  65. #ifndef _CRTAPI1
  66. #if _MSC_VER >= 800 && _M_IX86 >= 300
  67. #define _CRTAPI1 __cdecl
  68. #else  /* _MSC_VER >= 800 && _M_IX86 >= 300 */
  69. #define _CRTAPI1
  70. #endif  /* _MSC_VER >= 800 && _M_IX86 >= 300 */
  71. #endif  /* _CRTAPI1 */
  72.  
  73.  
  74. /* Define NULL pointer value and the offset() macro */
  75.  
  76. #ifndef NULL
  77. #ifdef __cplusplus
  78. #define NULL    0
  79. #else  /* __cplusplus */
  80. #define NULL    ((void *)0)
  81. #endif  /* __cplusplus */
  82. #endif  /* NULL */
  83.  
  84.  
  85. #define offsetof(s,m)   (size_t)&(((s *)0)->m)
  86.  
  87.  
  88. /* Declare reference to errno */
  89.  
  90. #if (defined (_MT) || defined (_DLL)) && !defined (_MAC)
  91. _CRTIMP extern int * __cdecl _errno(void);
  92. #define errno   (*_errno())
  93. #else  /* (defined (_MT) || defined (_DLL)) && !defined (_MAC) */
  94. _CRTIMP extern int errno;
  95. #endif  /* (defined (_MT) || defined (_DLL)) && !defined (_MAC) */
  96.  
  97.  
  98. /* define the implementation dependent size types */
  99.  
  100. #ifndef _PTRDIFF_T_DEFINED
  101. typedef int ptrdiff_t;
  102. #define _PTRDIFF_T_DEFINED
  103. #endif  /* _PTRDIFF_T_DEFINED */
  104.  
  105.  
  106. #ifndef _SIZE_T_DEFINED
  107. typedef unsigned int size_t;
  108. #define _SIZE_T_DEFINED
  109. #endif  /* _SIZE_T_DEFINED */
  110.  
  111.  
  112. #ifndef _WCHAR_T_DEFINED
  113. typedef unsigned short wchar_t;
  114. #define _WCHAR_T_DEFINED
  115. #endif  /* _WCHAR_T_DEFINED */
  116.  
  117.  
  118. #ifdef _MT
  119. _CRTIMP extern unsigned long  __cdecl __threadid(void);
  120. #define _threadid       (__threadid())
  121. _CRTIMP extern unsigned long  __cdecl __threadhandle(void);
  122. #endif  /* _MT */
  123.  
  124.  
  125. #ifdef __cplusplus
  126. }
  127. #endif  /* __cplusplus */
  128.  
  129. #endif  /* _INC_STDDEF */
  130.