Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/dinkum_en/c99/limits.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/dinkum_en/c99/limits.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/dinkum_en/c99/limits.html on line 4

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/dinkum_en/c99/limits.html on line 4
[Previous] [Contents] [Next]

<limits.h>


Include the standard header <limits.h> to determine various properties of the integer type representations. The standard header <limits.h> is available even in a freestanding implementation.

You can test the values of all these macros in an if directive. (The macros are #if expressions.)

#define CHAR_BIT <#if expression >= 8>
#define CHAR_MAX <#if expression >= 127>
#define CHAR_MIN <#if expression <= 0>
#define SCHAR_MAX <#if expression >= 127>
#define SCHAR_MIN <#if expression <= -127>
#define UCHAR_MAX <#if expression >= 255>
#define MB_LEN_MAX <#if expression >= 1>

#define SHRT_MAX <#if expression >= 32,767>
#define SHRT_MIN <#if expression <= -32,767>
#define USHRT_MAX <#if expression >= 65,535>

#define INT_MAX <#if expression >= 32,767>
#define INT_MIN <#if expression <= -32,767>
#define UINT_MAX <#if expression >= 65,535>

#define LONG_MAX <#if expression >= 2,147,483,647>
#define LONG_MIN <#if expression <= -2,147,483,647>
#define ULONG_MAX <#if expression >= 4,294,967,295>

#define LLONG_MAX <#if expression >= 9,223,372,036,854,775,807> [added with C99]
#define LLONG_MIN <#if expression <= -9,223,372,036,854,775,807> [added with C99]
#define ULLONG_MAX <#if expression >= 18,446,744,073,709,551,616> [added with C99]

CHAR_BIT

#define CHAR_BIT <#if expression >= 8>

The macro yields the maximum value for the number of bits used to represent an object of type char.

CHAR_MAX

#define CHAR_MAX <#if expression >= 127>

The macro yields the maximum value for type char. Its value is:

CHAR_MIN

#define CHAR_MIN <#if expression <= 0>

The macro yields the minimum value for type char. Its value is:

INT_MAX

#define INT_MAX <#if expression >= 32,767>

The macro yields the maximum value for type int.

INT_MIN

#define INT_MIN <#if expression <= -32,767>

The macro yields the minimum value for type int.

LLONG_MAX

#define LLONG_MAX <#if expression >= 9,223,372,036,854,775,807> [added with C99]

The macro yields the maximum value for type long long.

LLONG_MIN

#define LLONG_MIN <#if expression <= -9,223,372,036,854,775,807> [added with C99]

The macro yields the minimum value for type long long.

LONG_MAX

#define LONG_MAX <#if expression >= 2,147,483,647>

The macro yields the maximum value for type long.

LONG_MIN

#define LONG_MIN <#if expression <= -2,147,483,647>

The macro yields the minimum value for type long.

MB_LEN_MAX

#define MB_LEN_MAX <#if expression >= 1>

The macro yields the maximum number of characters that constitute a multibyte character in any supported locale. Its value is >= MB_CUR_MAX.

SCHAR_MAX

#define SCHAR_MAX <#if expression >= 127>

The macro yields the maximum value for type signed char.

SCHAR_MIN

#define SCHAR_MIN <#if expression <= -127>

The macro yields the minimum value for type signed char.

SHRT_MAX

#define SHRT_MAX <#if expression >= 32,767>

The macro yields the maximum value for type short.

SHRT_MIN

#define SHRT_MIN <#if expression <= -32,767>

The macro yields the minimum value for type short.

UCHAR_MAX

#define UCHAR_MAX <#if expression >= 255>

The macro yields the maximum value for type unsigned char.

UINT_MAX

#define UINT_MAX <#if expression >= 65,535>

The macro yields the maximum value for type unsigned int.

ULLONG_MAX

#define ULLONG_MAX <#if expression >= 18,446,744,073,709,551,616> [added with C99]

The macro yields the maximum value for type unsigned long long.

ULONG_MAX

#define ULONG_MAX <#if expression >= 4,294,967,295>

The macro yields the maximum value for type unsigned long.

USHRT_MAX

#define USHRT_MAX <#if expression >= 65,535>

The macro yields the maximum value for type unsigned short.


See also the Table of Contents and the Index.

Copyright © 1989-2002 by P.J. Plauger and Jim Brodie. All rights reserved.

[Previous] [Contents] [Next]

Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/dinkum_en/c99/limits.html on line 208

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/dinkum_en/c99/limits.html on line 208