The <climits>
header (from the C standard <limits.h>
header) defines parameters that characterize integral types. See <cfloat>
for the C characterization of the floating point types.
The native C++ header, <limits>
, defines the same information (and more), but without cumbersome macros. When writing new C++ code, use <limits>
instead of <climits>
.
The types for the _MIN
and _MAX
macros are reminders to the reader and are not descriptive of the actual types of the macro expansions. The actual type can be any integral type that would be the result of normal integral promotions for the corresponding type, e.g., unsigned
char
can be promoted to unsigned
int
, so UCHAR_MAX
might have type unsigned
int
.
All of the macros in <climits>
expand to constant expressions.
int CHAR_BIT
Number of bits per character.
char CHAR_MAX
Maximum value for the char
type. (Is the same as SCHAR_MAX
or UCHAR_MAX
.)
char CHAR_MIN
Minimum value for the char
type. (Is the same as SCHAR_MIN
or UCHAR_MIN
.)
int INT_MAX
Maximum value for the int
type.
int INT_MIN
Minimum value for the int
type.
long int LONG_MAX
Maximum value for the long
int
type.
long int LONG_MIN
Minimum value for the long
int
type.
int MB_LEN_MAX
Maximum number of bytes in any multibyte character, in any locale.
signed char SCHAR_MAX
Maximum value for the signed
char
type.
signed char SCHAR_MIN
Minimum value for the signed
char
type.
short SHRT_MAX
Maximum value for the short
type.
short SHRT_MIN
Minimum value for the short
type.
unsigned char UCHAR_MAX
Maximum value for the unsigned
char
type.
unsigned int UINT_MAX
Maximum value for the unsigned
int
type.
unsigned long ULONG_MAX
Maximum value for the unsigned
long
type.
unsigned short USHRT_MAX
Maximum value for the unsigned
short
type.