Regenerated from ../sysdeps/mach/hurd/errnos.awk ../manual/errno.texi ../../mach...
[platform/upstream/glibc.git] / limits.h
1 /* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
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.
8
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.
13
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
16 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17 Cambridge, MA 02139, USA.  */
18
19 /*
20  *      ANSI Standard: 4.14/2.2.4.2 Limits of integral types    <limits.h>
21  */
22
23 #include <features.h>
24
25 #ifdef  __USE_POSIX
26 /* POSIX adds things to <limits.h>.  */
27 #include <posix1_lim.h>
28 #endif
29
30 #ifdef  __USE_POSIX2
31 #include <posix2_lim.h>
32 #endif
33
34
35 #if     __GNUC__ >= 2
36
37  /* Get the compiler's limits.h, which defines all the ANSI constants.  */
38  #ifndef _LIBC_LIMITS_H_
39  #define _LIBC_LIMITS_H_        /* This tells it not to look for another.  */
40  #endif
41  #ifndef _GCC_LIMITS_H_         /* This is what GCC's file defines.  */
42  #include_next <limits.h>
43  #endif
44
45 #else   /* Not GCC 2.  */
46
47 /* We only protect from multiple inclusion here, because all the other
48    #include's protect themselves, and in GCC 2 we may #include_next through
49    multiple copies of this file before we get to GCC's.  */
50 #ifndef _LIMITS_H
51 #define _LIMITS_H
52
53 /* We don't have #include_next.
54    Define ANSI <limits.h> for standard 32-bit words.  */
55
56 /* These assume 8-bit `char's, 16-bit `short int's,
57    and 32-bit `int's and `long int's.  */
58
59 /* Number of bits in a `char'.  */
60 #define CHAR_BIT        8
61
62 /* Maximum length of any multibyte character in any locale.
63    Locale-writers should change this as necessary.  */
64 #define MB_LEN_MAX      1
65
66 /* Minimum and maximum values a `signed char' can hold.  */
67 #define SCHAR_MIN       (-128)
68 #define SCHAR_MAX       127
69
70 /* Maximum value an `unsigned char' can hold.  (Minimum is 0.)  */
71 #ifdef  __STDC__
72 #define UCHAR_MAX       255U
73 #else
74 #define UCHAR_MAX       255
75 #endif
76
77 /* Minimum and maximum values a `char' can hold.  */
78 #ifdef __CHAR_UNSIGNED__
79 #define CHAR_MIN        0
80 #define CHAR_MAX        UCHAR_MAX
81 #else
82 #define CHAR_MIN        SCHAR_MIN
83 #define CHAR_MAX        SCHAR_MAX
84 #endif
85
86 /* Minimum and maximum values a `signed short int' can hold.  */
87 #define SHRT_MIN        (-32768)
88 #define SHRT_MAX        32767
89
90 /* Maximum value an `unsigned short int' can hold.  (Minimum is 0.)  */
91 #define USHRT_MAX       65535
92
93 /* Minimum and maximum values a `signed int' can hold.  */
94 #define INT_MIN (- INT_MAX - 1)
95 #define INT_MAX 2147483647
96
97 /* Maximum value an `unsigned int' can hold.  (Minimum is 0.)  */
98 #ifdef  __STDC__
99 #define UINT_MAX        4294967295U
100 #else
101 #define UINT_MAX        4294967295
102 #endif
103
104 #ifdef __alpha__
105
106 /* Minimum and maximum values a `signed long int' can hold.  */
107 #define LONG_MAX        9223372036854775807L
108 #define LONG_MIN        (- LONG_MAX - 1L)
109
110 /* Maximum value an `unsigned long int' can hold.  (Minimum is 0.)  */
111 #define ULONG_MAX       18446744073709551615L
112
113 #else
114
115 /* Minimum and maximum values a `signed long int' can hold.  */
116 #define LONG_MAX        INT_MAX
117 #define LONG_MIN        INT_MIN
118
119 /* Maximum value an `unsigned long int' can hold.  (Minimum is 0.)  */
120 #define ULONG_MAX       UINT_MAX
121
122 #endif
123
124
125 #endif  /* limits.h  */
126 #endif  /* GCC 2.  */