home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c045 / 2.ddi / INCLUDE / STDDEF.H$ / STDDEF.bin
Encoding:
Text File  |  1992-01-01  |  1.8 KB  |  96 lines

  1. /***
  2. *stddef.h - definitions/declarations for common constants, types, variables
  3. *
  4. *    Copyright (c) 1985-1991, 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. ****/
  12.  
  13. #ifndef _INC_STDDEF
  14.  
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18.  
  19. #if defined(_DLL) && !defined(_MT)
  20. #error Cannot define _DLL without _MT
  21. #endif
  22.  
  23. #ifdef _MT
  24. #define _FAR_ __far
  25. #else
  26. #define _FAR_
  27. #endif
  28.  
  29. #if (_MSC_VER <= 600)
  30. #define __cdecl     _cdecl
  31. #define __far       _far
  32. #define __loadds    _loadds
  33. #define __near      _near
  34. #endif
  35.  
  36. /* define the NULL pointer value and the offsetof() macro */
  37.  
  38. #ifndef NULL
  39. #ifdef __cplusplus
  40. #define NULL    0
  41. #else
  42. #define NULL    ((void *)0)
  43. #endif
  44. #endif
  45.  
  46. /* the definition of offsetof() now used is equivalent to:
  47.  *
  48.  *    #define offsetof(s,m)    (size_t)&(((s *)0)->m)
  49.  *
  50.  * but has the advantage that it will not give rise to (valid) compiler
  51.  * warnings in large data models */
  52.  
  53. #define offsetof(s,m)    (size_t)( (char *)&(((s *)0)->m) - (char *)0 )
  54.  
  55.  
  56. /* declare reference to errno */
  57.  
  58. #ifdef    _MT
  59. extern int __far * __cdecl __far volatile _errno(void);
  60. #define errno    (*_errno())
  61. #else
  62. extern int __near __cdecl volatile errno;
  63. #endif
  64.  
  65.  
  66. /* define the implementation dependent size types */
  67.  
  68. #ifndef _PTRDIFF_T_DEFINED
  69. typedef int ptrdiff_t;
  70. #define _PTRDIFF_T_DEFINED
  71. #endif
  72.  
  73. #ifndef _SIZE_T_DEFINED
  74. typedef unsigned int size_t;
  75. #define _SIZE_T_DEFINED
  76. #endif
  77.  
  78. #ifndef _WCHAR_T_DEFINED
  79. typedef    unsigned short wchar_t;
  80. #define _WCHAR_T_DEFINED
  81. #endif
  82.  
  83.  
  84. #ifdef _MT
  85. /* define pointer to thread id value */
  86.  
  87. extern int __far *_threadid;
  88. #endif
  89.  
  90. #ifdef __cplusplus
  91. }
  92. #endif
  93.  
  94. #define _INC_STDDEF
  95. #endif    /* _INC_STDDEF */
  96.