Merging r37048, r37051, r37052, r37055 from the-real-msvc branch
[reactos.git] / reactos / include / crt / limits.h
1 /*
2 * limits.h
3 * This file has no copyright assigned and is placed in the Public Domain.
4 * This file is a part of the mingw-runtime package.
5 * No warranty is given; refer to the file DISCLAIMER within the package.
6 *
7 * Functions for manipulating paths and directories (included from io.h)
8 * plus functions for setting the current drive.
9 *
10 * Defines constants for the sizes of integral types.
11 *
12 * NOTE: GCC should supply a version of this header and it should be safe to
13 * use that version instead of this one (maybe safer).
14 *
15 */
16
17 #ifndef _LIMITS_H_
18 #define _LIMITS_H_
19
20 /* All the headers include this file. */
21 #include <_mingw.h>
22
23 /*
24 * File system limits
25 *
26 * TODO: NAME_MAX and OPEN_MAX are file system limits or not? Are they the
27 * same as FILENAME_MAX and FOPEN_MAX from stdio.h?
28 * NOTE: Apparently the actual size of PATH_MAX is 260, but a space is
29 * required for the NUL. TODO: Test?
30 */
31 #define PATH_MAX 259
32
33 /*
34 * Characteristics of the char data type.
35 */
36 #define CHAR_BIT 8
37 #define MB_LEN_MAX 2
38
39 #define SCHAR_MIN (-128)
40 #define SCHAR_MAX 127
41
42 #define UCHAR_MAX 255
43
44 /* TODO: Is this safe? I think it might just be testing the preprocessor,
45 * not the compiler itself... */
46 #if ('\x80' < 0)
47 #define CHAR_MIN SCHAR_MIN
48 #define CHAR_MAX SCHAR_MAX
49 #else
50 #define CHAR_MIN 0
51 #define CHAR_MAX UCHAR_MAX
52 #endif
53
54 /*
55 * Maximum and minimum values for ints.
56 */
57 #define INT_MAX 2147483647
58 #define INT_MIN (-INT_MAX-1)
59
60 #define UINT_MAX 0xffffffff
61
62 /*
63 * Maximum and minimum values for shorts.
64 */
65 #define SHRT_MAX 32767
66 #define SHRT_MIN (-SHRT_MAX-1)
67
68 #define USHRT_MAX 0xffff
69
70 /*
71 * Maximum and minimum values for longs and unsigned longs.
72 *
73 * TODO: This is not correct for Alphas, which have 64 bit longs.
74 */
75 #define LONG_MAX 2147483647L
76 #define LONG_MIN (-LONG_MAX-1)
77
78 #define ULONG_MAX 0xffffffffUL
79
80 #ifndef __STRICT_ANSI__
81 /* POSIX wants this. */
82 #define SSIZE_MAX LONG_MAX
83 #endif
84
85 #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
86 || !defined(__STRICT_ANSI__)
87 /* ISO C9x macro names */
88 #define LLONG_MAX 9223372036854775807LL
89 #define LLONG_MIN (-LLONG_MAX - 1)
90 #define ULLONG_MAX (2ULL * LLONG_MAX + 1)
91 #endif
92
93 /*
94 * The GNU C compiler also allows 'long long int'
95 */
96 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
97
98 #define LONG_LONG_MAX 9223372036854775807LL
99 #define LONG_LONG_MIN (-LONG_LONG_MAX-1)
100 #define ULONG_LONG_MAX (2ULL * LONG_LONG_MAX + 1)
101
102 /* MSVC compatibility */
103 #define _I64_MIN LONG_LONG_MIN
104 #define _I64_MAX LONG_LONG_MAX
105 #define _UI64_MAX ULONG_LONG_MAX
106
107 #endif /* Not Strict ANSI and GNU C compiler */
108
109
110 #endif /* not _LIMITS_H_ */