stddef.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*++
  2. Copyright (c) 2013 Minoca Corp.
  3. This file is licensed under the terms of the GNU Lesser General Public
  4. License version 3. Alternative licensing terms are available. Contact
  5. info@minocacorp.com for details.
  6. Module Name:
  7. stddef.h
  8. Abstract:
  9. This header contains essential C definitions. This header is often
  10. overridden by a compiler internal version.
  11. Author:
  12. Evan Green 4-Mar-2013
  13. --*/
  14. #ifndef _STDDEF_H
  15. #define _STDDEF_H
  16. //
  17. // --------------------------------------------------------------------- Macros
  18. //
  19. //
  20. // This macro gets the offset, in bytes, from the beginning of the given
  21. // structure type to the given structure member.
  22. //
  23. #define offsetof(_Type, _Member) __builtin_offsetof(_Type, _Member)
  24. //
  25. // ---------------------------------------------------------------- Definitions
  26. //
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. //
  31. // Define NULL if it hasn't already been defined.
  32. //
  33. #ifndef NULL
  34. #ifdef __cplusplus
  35. #define NULL 0
  36. #else
  37. #define NULL ((void *)0)
  38. #endif
  39. #endif
  40. //
  41. // ------------------------------------------------------ Data Type Definitions
  42. //
  43. //
  44. // Define the type returned by the compiler when two pointers are subtracted.
  45. //
  46. typedef __PTRDIFF_TYPE__ ptrdiff_t;
  47. //
  48. // Define the widest character the compiler supports.
  49. //
  50. #ifndef __cplusplus
  51. typedef __WCHAR_TYPE__ wchar_t;
  52. #endif
  53. //
  54. // The int is to char as wint_t is to wchar_t.
  55. //
  56. typedef __WINT_TYPE__ wint_t;
  57. //
  58. // Define the type the compiler returns from the sizeof() operator.
  59. //
  60. typedef __SIZE_TYPE__ size_t;
  61. #ifdef __cplusplus
  62. }
  63. #endif
  64. #endif