# Implementation-Defined Limit Macros

Include

<limits.h>

Remarks

The macros in following table relate to sizes of the integer types and expand to constant expressions that can be used in #if preprocessor directives.

The Baseline and non-enhanced Mid-range PIC devices do not support 64-bit integer types, and all the long long int integer types are 32 bits wide for these devices. For all other devices, these types are 64-bit wide, hence the macro values defined by <limits.h> associated with these types will be different, as indicated in the table.

Table 1. Declarations Provided by <limits.h>
Macro Name Description Value
CHAR_BIT Number of bits to represent type char 8
CHAR_MAX Maximum value of a char

When -funsigned-char is in effect (or using XC8 for PIC devices and no plain char type option has been used): 255

When -fsigned-char is in effect (or using XC8 for AVR devices, XC16, or XC32 and no plain char type option has been used): 127

CHAR_MIN Minimum value of a char

When -funsigned-char is in effect (or using XC8 for PIC devices and no plain char type option has been used): 0

When -fsigned-char is in effect (or using XC8 for AVR devices, XC16, or XC32 and no plain char type option has been used): -128

UCHAR_MAX Maximum value of an unsigned char 255
SCHAR_MAX Maximum value of a signed char 127
SCHAR_MIN Minimum value of a signed char -128
USHRT_MAX Maximum value of an unsigned short int 65535
SHRT_MAX  Maximum value of a short int 32767
SHRT_MIN  Minimum value of a short int -32768
UINT_MAX Maximum value of an unsigned int 65535
INT_MAX Maximum value of a int

MPLAB XC8: 32767

MPLAB XC16: 32767

MPLAB XC32: 2147483647

INT_MIN Minimum value of a int

MPLAB XC8: -32768

MPLAB XC16: -32768

MPLAB XC32: -2147483648

ULONG_MAX Maximum value of a long unsigned int All: 4294967295
LONG_MAX Maximum value of a long int All: 2147483647
LONG_MIN Minimum value of a long int All: -2147483648
ULLONG_MAX Maximum value of a long long unsigned int

Devices lacking 64 bit support (see Remarks): 4294967295

All other devices: 18446744073709551615

LLONG_MAX Maximum value of a long long int

Devices lacking 64 bit support (see Remarks): 2147483647

All other devices: 9223372036854775807

LLONG_MIN Minimum value of a long long int

Devices lacking 64 bit support (see Remarks): -2147483648

All other devices: -9223372036854775808

MB_LEN_MAX  Maximum number of bytes in a multibyte character

MPLAB XC8: 1

MPLAB XC16: 4

MPLAB XC32: 16