limits(3)
- NetBSD Manual Pages
LIMITS(3) NetBSD Library Functions Manual LIMITS(3)
NAME
limits -- standard limits
SYNOPSIS
#include <limits.h>
DESCRIPTION
The <limits.h> header defines various compile-time and runtime limits.
These can be grouped into three categories:
1. Compile-time limits defined in a header file.
2. Runtime system limits that are not associated with a file or
directory; see sysconf(3).
3. Runtime limits that are associated with a file or directory;
see pathconf(2).
The <limits.h> header has been standardized by at least three entities.
ISO Limits
The limits defined by the ISO/IEC 9899:1999 (``ISO C99'') standard are
all compile-time limits. The numerical (integer) limits are:
Constant Type Minimum value
CHAR_BIT char 8
SCHAR_MAX signed char 127
SCHAR_MIN signed char -127
UCHAR_MAX unsigned char 255
INT_MAX int 32767
INT_MIN int -32767
UINT_MAX unsigned int 65535
SHRT_MIN short -32767
SHRT_MAX short 32767
USHRT_MAX unsigned short 65535
LONG_MAX long int 2147483647
LONG_MIN long int -2147483647
ULONG_MAX unsigned long int 4294967295
LLONG_MAX long long int 9223372036854775807
LLONG_MIN long long int -9223372036854775807
ULLONG_MAX unsigned long long int 18446744073709551615
MB_LEN_MAX - 1
All listed limits may vary across machines and operating systems. The
standard guarantees only that the implementation-defined values are equal
or greater in absolute value to those shown. The values permit a system
with 16-bit integers using one's complement arithmetic.
Depending whether the system defines char as signed or unsigned, the max-
imum and minimum values are:
Constant Type Minimum value
CHAR_MAX char either SCHAR_MAX or UCHAR_MAX
CHAR_MIN char either SCHAR_MIN or 0
The two special cases, CHAR_BIT and MB_LEN_MAX, define the number of bits
in char and the maximum number of bytes in a multibyte character con-
stant, respectively.
POSIX Limits
The POSIX.1 standard specifies numerous limits related to the operating
system. For each limit, a separate constant prefixed with ``_POSIX_''
defines the lowest value that the limit is allowed to have on any POSIX
compliant system. For instance, _POSIX_OPEN_MAX defines the minimum
upper bound permitted by POSIX for the number of files that a single
process may have open at any time. This ensures that a portable program
can safely reach these limits without prior knowledge about the actual
limits used in a particular system.
As the limits are not necessary invariant, pathconf(2) and sysconf(3)
should be used to determine the actual value of a limit at runtime. The
manual pages of these two functions also contain a more detailed descrip-
tion of the limits available in NetBSD.
XSI Limits
Also the X/Open System Interface Extension (XSI) specifies few limits.
In NetBSD these are limited to LONG_BIT (the number of bits in long),
WORD_BIT (the number of bits in a ``word''), and few limits related to
float and double.
SEE ALSO
getconf(1), pathconf(2), sysconf(3), types(3), unistd(3)
Richard W. Stevens and Stephen A. Rago, Advanced Programming in the UNIX
Environment, Addison-Wesley, Second Edition, 2005.
NetBSD 9.3 August 9, 2011 NetBSD 9.3
Powered by man-cgi (2021-06-01).
Maintained for NetBSD
by Kimmo Suominen.
Based on man-cgi by Panagiotis Christias.