Start anew
[msysgit.git] / mingw / include / limits.h
blob04f79f58cbcab070983a87df928983f85e2f9d82
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.
7 * Functions for manipulating paths and directories (included from io.h)
8 * plus functions for setting the current drive.
10 * Defines constants for the sizes of integral types.
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).
17 #ifndef _LIMITS_H_
18 #define _LIMITS_H_
20 /* All the headers include this file. */
21 #include <_mingw.h>
24 * File system limits
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?
31 #define PATH_MAX 259
34 * Characteristics of the char data type.
36 * TODO: Is MB_LEN_MAX correct?
38 #define CHAR_BIT 8
39 #define MB_LEN_MAX 2
41 #define SCHAR_MIN (-128)
42 #define SCHAR_MAX 127
44 #define UCHAR_MAX 255
46 /* TODO: Is this safe? I think it might just be testing the preprocessor,
47 * not the compiler itself... */
48 #if ('\x80' < 0)
49 #define CHAR_MIN SCHAR_MIN
50 #define CHAR_MAX SCHAR_MAX
51 #else
52 #define CHAR_MIN 0
53 #define CHAR_MAX UCHAR_MAX
54 #endif
57 * Maximum and minimum values for ints.
59 #define INT_MAX 2147483647
60 #define INT_MIN (-INT_MAX-1)
62 #define UINT_MAX 0xffffffff
65 * Maximum and minimum values for shorts.
67 #define SHRT_MAX 32767
68 #define SHRT_MIN (-SHRT_MAX-1)
70 #define USHRT_MAX 0xffff
73 * Maximum and minimum values for longs and unsigned longs.
75 * TODO: This is not correct for Alphas, which have 64 bit longs.
77 #define LONG_MAX 2147483647L
78 #define LONG_MIN (-LONG_MAX-1)
80 #define ULONG_MAX 0xffffffffUL
82 #ifndef __STRICT_ANSI__
83 /* POSIX wants this. */
84 #define SSIZE_MAX LONG_MAX
85 #endif
87 #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
88 || !defined(__STRICT_ANSI__)
89 /* ISO C9x macro names */
90 #define LLONG_MAX 9223372036854775807LL
91 #define LLONG_MIN (-LLONG_MAX - 1)
92 #define ULLONG_MAX (2ULL * LLONG_MAX + 1)
93 #endif
96 * The GNU C compiler also allows 'long long int'
98 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
100 #define LONG_LONG_MAX 9223372036854775807LL
101 #define LONG_LONG_MIN (-LONG_LONG_MAX-1)
102 #define ULONG_LONG_MAX (2ULL * LONG_LONG_MAX + 1)
104 /* MSVC compatibility */
105 #define _I64_MIN LONG_LONG_MIN
106 #define _I64_MAX LONG_LONG_MAX
107 #define _UI64_MAX ULONG_LONG_MAX
109 #endif /* Not Strict ANSI and GNU C compiler */
112 #endif /* not _LIMITS_H_ */