4 * Standard type definitions provided by the C library.
6 * NOTE: Actually supplied by the compiler (correct?). As such, GCC
7 * supplies a version of this header file. Unfortunately, GCC's
8 * version is all tied up with the way other headers for the
9 * GNU C library are implemented (or vice-versa), in a similar
10 * way to how the other Mingw32 headers are dependent on
11 * certain internals of this file. It is not clear to me whether
12 * you can safely use the GCC version in place of this version.
13 * TODO: Line up usage in other header files to work with GCC
16 * This file is part of the Mingw32 package.
19 * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
21 * THIS SOFTWARE IS NOT COPYRIGHTED
23 * This source code is offered for use in the public domain. You may
24 * use, modify or distribute it freely.
26 * This code is distributed in the hope that it will be useful but
27 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
28 * DISCLAMED. This includes but is not limited to warranties of
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
33 * $Date: 2002/09/08 10:22:31 $
38 #ifndef __MSVCRT_STDDEF_H_
41 * Any one of these symbols __need_* means that a standard header file
42 * wants us just to define one data type. So don't define
43 * the symbols that indicate this file's entire job has been done.
45 #if (!defined(__need_wchar_t) && !defined(__need_wint_t) \
46 && !defined(__need_size_t) && !defined(__need_ptrdiff_t) \
47 && !defined(__need_NULL))
48 #define __MSVCRT_STDDEF_H_
52 * NOTE: The following typedefs are done using __xxx_TYPE__ defines followed
53 * by typedefs using those defines. I have chosen to do it this way because
54 * GCC supplies definitions for __xxx_TYPE__ macros and if, for example, your
55 * size_t is typedef'ed differently from what GCC expects it will give you
56 * warnings when you prototype functions like memcmp and memcpy. The values
57 * for __xxx_TYPE__ in this header file are the same as those given by GCC.
58 * Those values appear to work with the MSVCRT functions.
62 * Signed type of difference of two pointers.
65 /* Define this type if we are doing the whole job, or if we want this type
67 #if defined (__MSVCRT_STDDEF_H_) || defined (__need_ptrdiff_t)
71 #ifndef __PTRDIFF_TYPE__
72 #define __PTRDIFF_TYPE__ int
74 typedef __PTRDIFF_TYPE__
ptrdiff_t;
77 /* If this symbol has done its job, get rid of it. */
78 #undef __need_ptrdiff_t
80 #endif /* __MSVCRT_STDDEF_H_ or __need_ptrdiff_t. */
83 * Unsigned type of `sizeof' something.
87 /* Define this type if we are doing the whole job,
88 * or if we want this type in particular. */
89 #if defined (__MSVCRT_STDDEF_H_) || defined (__need_size_t)
93 #define SIZE_T_DEFINED
96 #define __SIZE_TYPE__ unsigned int
98 typedef __SIZE_TYPE__
size_t;
103 #endif /* __MSVCRT_STDDEF_H_ or __need_size_t. */
105 /* Wide character type.
106 Locale-writers should change this as necessary to
107 be big enough to hold unique values not between 0 and 127,
108 and not (wchar_t) -1, for each defined multibyte character. */
110 /* Define this type if we are doing the whole job,
111 or if we want this type in particular. */
112 #if defined (__MSVCRT_STDDEF_H_) || defined (__need_wchar_t)
117 #define _WCHAR_T_DEFINED
118 #ifndef __WCHAR_TYPE__
119 #define __WCHAR_TYPE__ short unsigned int
122 typedef __WCHAR_TYPE__
wchar_t;
124 #endif /* wchar_t not already defined */
126 #undef __need_wchar_t
128 #endif /* __MSVCRT_STDDEF_H_ or __need_wchar_t. */
131 * wint_t, the equivalent of int in wchar ctype functions.
133 #if defined (__MSVCRT_STDDEF_H_) || defined (__need_wint_t)
137 #define _WINT_T /* To satisfy libstdc++ */
138 #ifndef __WINT_TYPE__
139 #define __WINT_TYPE__ short int
140 #endif /* Not defined __WINT_TYPE__ */
142 typedef __WINT_TYPE__
wint_t;
143 #endif /* Not defined _WINT_T_ */
147 #endif /* __MSVCRT_STDDEF_H_ or __need_wint_t. */
151 * A null pointer constant.
154 #if defined (__MSVCRT_STDDEF_H_) || defined (__need_NULL)
158 #endif /* __MSVCRT_STDDEF_H_ or __need_NULL */
164 * Offsetof, a macro for finding the offset of a member in a structure.
165 * Works by returning the 'address' of the MEMBER of a TYPE struct at address
169 #if defined (__MSVCRT_STDDEF_H_)
170 #define offsetof(TYPE, MEMBER) ((size_t) &( ((TYPE *) 0)->MEMBER ))
171 #endif /* __MSVCRT_STDDEF_H_ */
174 #endif /* not __MSVCRT_STDDEF_H_ */