ptg10805159
Section 2.5 Limits 37
- Runtime limits not associated with a file or directory (thesysconffunction)
- Runtime limits that areassociated with a file or a directory (thepathconfand
fpathconffunctions)
To further confuse things, if a particular runtime limit does not vary on a given system,
it can be defined statically in a header.If it is not defined in a header,however,the
application must call one of the threeconffunctions (which we describe shortly) to
determine its value at runtime.
Minimum
Name Description acceptable value Typical value
CHAR_BIT bits in achar 88
CHAR_MAX max value ofchar (see later) 127
CHAR_MIN min value ofchar (see later) − 128
SCHAR_MAX max value ofsigned char 127 127
SCHAR_MIN min value ofsigned char − 127 − 128
UCHAR_MAX max value ofunsigned char 255 255
INT_MAX max value ofint 32,767 2,147,483,647
INT_MIN min value ofint −32,767 −2,147,483,648
UINT_MAX max value ofunsigned int 65,535 4,294,967,295
SHRT_MAX max value ofshort 32,767 32,767
SHRT_MIN min value ofshort −32,767 −32,768
USHRT_MAX max value ofunsigned short 65,535 65,535
LONG_MAX max value oflong 2,147,483,647 2,147,483,647
LONG_MIN min value oflong −2,147,483,647 −2,147,483,648
ULONG_MAX max value ofunsigned long 4,294,967,295 4,294,967,295
LLONG_MAX max value oflong long 9,223,372,036,854,775,807 9,223,372,036,854,775,807
LLONG_MIN min value oflong long −9,223,372,036,854,775,807 −9,223,372,036,854,775,808
ULLONG_MAX max value ofunsigned 18,446,744,073,709,551,615 18,446,744,073,709,551,615
long long
MB_LEN_MAX max number of bytes in a 16
multibyte character constant
Figure 2.6Sizes of integral values from<limits.h>
2.5.1 ISOCLimits
All of the compile-time limits defined by ISO C aredefined in the file<limits.h>(see
Figure2.6). These constants don’t change in a given system. The thirdcolumn in
Figure2.6 shows the minimum acceptable values from the ISO C standard. This allows
for a system with 16-bit integers using one’s-complement arithmetic. The fourth
column shows the values from a Linux system with 32-bit integers using two’s-
complement arithmetic. Note that none of the unsigned data types has a minimum
value, as this value must be 0 for an unsigned data type. On a 64-bit system, the values
forlonginteger maximums match the maximum values forlong longintegers.
One difference that we will encounter is whether a system provides signed or
unsigned character values. From the fourth column in Figure2.6, we see that this