Update.
[glibc.git] / include / limits.h
blobb149ba1a73b666e87591dccd51a32feb9073eaf7
1 /* Copyright (C) 1991, 1992, 1996, 1997 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
20 * ISO C Standard: 4.14/2.2.4.2 Limits of integral types <limits.h>
23 #ifndef _LIBC_LIMITS_H_
24 #define _LIBC_LIMITS_H_ 1
26 #include <features.h>
28 #ifdef __USE_POSIX
29 /* POSIX adds things to <limits.h>. */
30 # include <bits/posix1_lim.h>
31 #endif
33 #ifdef __USE_POSIX2
34 # include <bits/posix2_lim.h>
35 #endif
37 #ifdef __USE_XOPEN
38 # include <bits/xopen_lim.h>
39 #endif
42 /* Maximum length of any multibyte character in any locale.
43 We define this value here since the gcc header does not define
44 the correct value. */
45 #define MB_LEN_MAX 6
48 #if __GNUC__ >= 2
50 /* Get the compiler's limits.h, which defines all the ANSI constants. */
51 # ifndef _GCC_LIMITS_H_ /* This is what GCC's file defines. */
52 # include_next <limits.h>
53 # endif
55 #else /* Not GCC 2. */
57 /* We only protect from multiple inclusion here, because all the other
58 #include's protect themselves, and in GCC 2 we may #include_next through
59 multiple copies of this file before we get to GCC's. */
60 # ifndef _LIMITS_H
61 # define _LIMITS_H 1
63 /* We don't have #include_next.
64 Define ANSI <limits.h> for standard 32-bit words. */
66 /* These assume 8-bit `char's, 16-bit `short int's,
67 and 32-bit `int's and `long int's. */
69 /* Number of bits in a `char'. */
70 # define CHAR_BIT 8
72 /* Minimum and maximum values a `signed char' can hold. */
73 # define SCHAR_MIN (-128)
74 # define SCHAR_MAX 127
76 /* Maximum value an `unsigned char' can hold. (Minimum is 0.) */
77 # define UCHAR_MAX 255
79 /* Minimum and maximum values a `char' can hold. */
80 # ifdef __CHAR_UNSIGNED__
81 # define CHAR_MIN 0
82 # define CHAR_MAX UCHAR_MAX
83 # else
84 # define CHAR_MIN SCHAR_MIN
85 # define CHAR_MAX SCHAR_MAX
86 # endif
88 /* Minimum and maximum values a `signed short int' can hold. */
89 # define SHRT_MIN (-32768)
90 # define SHRT_MAX 32767
92 /* Maximum value an `unsigned short int' can hold. (Minimum is 0.) */
93 # define USHRT_MAX 65535
95 /* Minimum and maximum values a `signed int' can hold. */
96 # define INT_MIN (-INT_MAX - 1)
97 # define INT_MAX 2147483647
99 /* Maximum value an `unsigned int' can hold. (Minimum is 0.) */
100 # ifdef __STDC__
101 # define UINT_MAX 4294967295U
102 # else
103 # define UINT_MAX 4294967295
104 # endif
106 /* Minimum and maximum values a `signed long int' can hold. */
107 # ifdef __alpha__
108 # define LONG_MAX 9223372036854775807L
109 # else
110 # define LONG_MAX 2147483647L
111 # endif
112 # define LONG_MIN (-LONG_MAX - 1L)
114 /* Maximum value an `unsigned long int' can hold. (Minimum is 0.) */
115 # ifdef __alpha__
116 # define ULONG_MAX 18446744073709551615UL
117 # else
118 # ifdef __STDC__
119 # define ULONG_MAX 4294967295UL
120 # else
121 # define ULONG_MAX 4294967295L
122 # endif
123 # endif
125 # endif /* limits.h */
126 #endif /* GCC 2. */
128 #endif /* !_LIBC_LIMITS_H_ */