2003-08-07 20:26:28 +04:00
|
|
|
/* $NetBSD: limits.h,v 1.17 2003/08/07 16:27:59 agc Exp $ */
|
1994-10-27 07:14:23 +03:00
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1988 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
2003-08-07 20:26:28 +04:00
|
|
|
* 3. Neither the name of the University nor the names of its contributors
|
1993-03-21 12:45:37 +03:00
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
1994-10-27 07:14:23 +03:00
|
|
|
* @(#)limits.h 7.2 (Berkeley) 6/28/90
|
1993-03-21 12:45:37 +03:00
|
|
|
*/
|
|
|
|
|
1998-01-10 01:23:44 +03:00
|
|
|
#ifndef _MACHINE_LIMITS_H_
|
|
|
|
#define _MACHINE_LIMITS_H_
|
|
|
|
|
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.
This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
2003-04-29 03:16:11 +04:00
|
|
|
#include <sys/featuretest.h>
|
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
#define CHAR_BIT 8 /* number of bits in a char */
|
2000-08-09 02:31:13 +04:00
|
|
|
#define MB_LEN_MAX 32 /* no multibyte characters */
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1995-12-21 04:08:59 +03:00
|
|
|
#define SCHAR_MAX 0x7f /* max value for a signed char */
|
|
|
|
#define SCHAR_MIN (-0x7f-1) /* min value for a signed char */
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1995-12-21 02:30:57 +03:00
|
|
|
#define UCHAR_MAX 0xffU /* max value for an unsigned char */
|
1993-03-21 12:45:37 +03:00
|
|
|
#define CHAR_MAX 0x7f /* max value for a char */
|
|
|
|
#define CHAR_MIN (-0x7f-1) /* min value for a char */
|
|
|
|
|
1995-12-21 02:30:57 +03:00
|
|
|
#define USHRT_MAX 0xffffU /* max value for an unsigned short */
|
1993-03-21 12:45:37 +03:00
|
|
|
#define SHRT_MAX 0x7fff /* max value for a short */
|
|
|
|
#define SHRT_MIN (-0x7fff-1) /* min value for a short */
|
|
|
|
|
1995-12-21 02:30:57 +03:00
|
|
|
#define UINT_MAX 0xffffffffU /* max value for an unsigned int */
|
1993-03-21 12:45:37 +03:00
|
|
|
#define INT_MAX 0x7fffffff /* max value for an int */
|
|
|
|
#define INT_MIN (-0x7fffffff-1) /* min value for an int */
|
|
|
|
|
1995-12-21 04:08:59 +03:00
|
|
|
#define ULONG_MAX 0xffffffffUL /* max value for an unsigned long */
|
|
|
|
#define LONG_MAX 0x7fffffffL /* max value for a long */
|
|
|
|
#define LONG_MIN (-0x7fffffffL-1) /* min value for a long */
|
1993-09-16 10:01:11 +04:00
|
|
|
|
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.
This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
2003-04-29 03:16:11 +04:00
|
|
|
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
|
|
|
|
defined(_NETBSD_SOURCE)
|
1994-05-09 07:23:03 +04:00
|
|
|
#define SSIZE_MAX INT_MAX /* max value for a ssize_t */
|
|
|
|
|
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.
This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
2003-04-29 03:16:11 +04:00
|
|
|
#if defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L || \
|
|
|
|
defined(_NETBSD_SOURCE)
|
2000-03-07 22:31:49 +03:00
|
|
|
#define ULLONG_MAX 0xffffffffffffffffULL /* max unsigned long long */
|
|
|
|
#define LLONG_MAX 0x7fffffffffffffffLL /* max signed long long */
|
|
|
|
#define LLONG_MIN (-0x7fffffffffffffffLL-1) /* min signed long long */
|
|
|
|
#endif
|
|
|
|
|
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.
This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
2003-04-29 03:16:11 +04:00
|
|
|
#if defined(_NETBSD_SOURCE)
|
1994-05-09 07:23:03 +04:00
|
|
|
#define SIZE_T_MAX UINT_MAX /* max value for a size_t */
|
|
|
|
|
1995-12-21 02:30:57 +03:00
|
|
|
#define UQUAD_MAX 0xffffffffffffffffULL /* max unsigned quad */
|
1993-09-16 10:01:11 +04:00
|
|
|
#define QUAD_MAX 0x7fffffffffffffffLL /* max signed quad */
|
|
|
|
#define QUAD_MIN (-0x7fffffffffffffffLL-1) /* min signed quad */
|
|
|
|
|
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.
This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
2003-04-29 03:16:11 +04:00
|
|
|
#endif /* _NETBSD_SOURCE */
|
|
|
|
#endif /* _POSIX_C_SOURCE || _XOPEN_SOURCE || _NETBSD_SOURCE */
|
1994-10-05 20:16:29 +03:00
|
|
|
|
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.
This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
2003-04-29 03:16:11 +04:00
|
|
|
#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
|
1994-10-05 20:16:29 +03:00
|
|
|
#define LONG_BIT 32
|
|
|
|
#define WORD_BIT 32
|
|
|
|
|
|
|
|
#define DBL_DIG 15
|
|
|
|
#define DBL_MAX 1.7976931348623157E+308
|
|
|
|
#define DBL_MIN 2.2250738585072014E-308
|
|
|
|
|
|
|
|
#define FLT_DIG 6
|
|
|
|
#define FLT_MAX 3.40282347E+38F
|
|
|
|
#define FLT_MIN 1.17549435E-38F
|
|
|
|
#endif
|
1998-01-10 01:23:44 +03:00
|
|
|
|
|
|
|
#endif /* _MACHINE_LIMITS_H_ */
|