OSDN Git Service

Make strnlen() available for all MSVCRT.DLL versions.
[mingw/mingw-org-wsl.git] / mingwrt / include / 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: PATH_MAX is the POSIX equivalent for Microsoft's MAX_PATH; the two
29  *       are semantically identical, with a limit of 259 characters for the
30  *       path name, plus one for a terminating NUL, for a total of 260.
31  */
32 #define PATH_MAX        260
33
34 /*
35  * Characteristics of the char data type.
36  *
37  * TODO: Is MB_LEN_MAX correct?
38  */
39 #define CHAR_BIT        8
40 #define MB_LEN_MAX      2
41
42 #define SCHAR_MIN       (-128)
43 #define SCHAR_MAX       127
44
45 #define UCHAR_MAX       255
46
47 /* TODO: Is this safe? I think it might just be testing the preprocessor,
48  *       not the compiler itself... */
49 #if     ('\x80' < 0)
50 #define CHAR_MIN        SCHAR_MIN
51 #define CHAR_MAX        SCHAR_MAX
52 #else
53 #define CHAR_MIN        0
54 #define CHAR_MAX        UCHAR_MAX
55 #endif
56
57 /*
58  * Maximum and minimum values for ints.
59  */
60 #define INT_MAX         2147483647
61 #define INT_MIN         (-INT_MAX-1)
62
63 #define UINT_MAX        0xffffffff
64
65 /*
66  * Maximum and minimum values for shorts.
67  */
68 #define SHRT_MAX        32767
69 #define SHRT_MIN        (-SHRT_MAX-1)
70
71 #define USHRT_MAX       0xffff
72
73 /*
74  * Maximum and minimum values for longs and unsigned longs.
75  *
76  * TODO: This is not correct for Alphas, which have 64 bit longs.
77  */
78 #define LONG_MAX        2147483647L
79 #define LONG_MIN        (-LONG_MAX-1)
80
81 #define ULONG_MAX       0xffffffffUL
82
83 #ifndef __STRICT_ANSI__
84 /* POSIX wants this.  */
85 #define SSIZE_MAX LONG_MAX
86 #endif
87
88 #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
89      || !defined(__STRICT_ANSI__)
90 /* ISO C9x macro names */
91 #define LLONG_MAX 9223372036854775807LL
92 #define LLONG_MIN (-LLONG_MAX - 1)
93 #define ULLONG_MAX (2ULL * LLONG_MAX + 1)
94 #endif
95
96 /*
97  * The GNU C compiler also allows 'long long int'
98  */
99 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
100
101 #define LONG_LONG_MAX   9223372036854775807LL
102 #define LONG_LONG_MIN   (-LONG_LONG_MAX-1)
103 #define ULONG_LONG_MAX  (2ULL * LONG_LONG_MAX + 1)
104
105 /* MSVC compatibility */
106 #define _I64_MIN LONG_LONG_MIN
107 #define _I64_MAX LONG_LONG_MAX
108 #define _UI64_MAX ULONG_LONG_MAX
109
110 #endif /* Not Strict ANSI and GNU C compiler */
111
112
113 #endif /* not _LIMITS_H_ */