C++标准模板(STL)- 类型支持 (定宽整数类型)(INT8_MIN,INT_FAST8_MIN,INT_LEAST8_MIN,INTPTR_MIN,INTMAX_MIN )

定宽整数类型

宏常量

定义于头文件 
有符号整数:最小值

INT8_MININT16_MININT32_MININT64_MIN

int8_t、int16_t、int32_t、int64_t 类型对象的最小值
(宏常量)

INT_FAST8_MININT_FAST16_MININT_FAST32_MININT_FAST64_MIN

int_fast8_t、int_fast16_t、int_fast32_t、int_fast64_t 类型对象的最小值
(宏常量)

INT_LEAST8_MININT_LEAST16_MININT_LEAST32_MININT_LEAST64_MIN

int_least8_t、int_least16_t、int_least32_t、int_least64_t 类型对象的最小值
(宏常量)

INTPTR_MIN

intptr_t 类型对象的最小值
(宏常量)

INTMAX_MIN

intmax_t 类型对象的最小值
(宏常量)
有符号整数:最大值

INT8_MAXINT16_MAXINT32_MAXINT64_MAX

int8_t、int16_t、int32_t、int64_t 类型对象的最大值
(宏常量)

INT_FAST8_MAXINT_FAST16_MAXINT_FAST32_MAXINT_FAST64_MAX

int_fast8_t、int_fast16_t、int_fast32_t、int_fast64_t 类型对象的最大值
(宏常量)

INT_LEAST8_MAXINT_LEAST16_MAXINT_LEAST32_MAXINT_LEAST64_MAX

int_least8_t、int_least16_t、int_least32_t、int_least64_t 类型对象的最大值
(宏常量)

INTPTR_MAX

intptr_t 类型对象的最大值
(宏常量)

INTMAX_MAX

intmax_t 类型对象的最大值
(宏常量)
无符号整数:最大值

UINT8_MAXUINT16_MAXUINT32_MAXUINT64_MAX

uint8_t、uint16_t、uint32_t、uint64_t 类型对象的最大值
(宏常量)

UINT_FAST8_MAXUINT_FAST16_MAXUINT_FAST32_MAXUINT_FAST64_MAX

uint_fast8_t、uint_fast16_t、uint_fast32_t、uint_fast64_t 类型对象的最大值
(宏常量)

UINT_LEAST8_MAXUINT_LEAST16_MAXUINT_LEAST32_MAXUINT_LEAST64_MAX

uint_least8_t、uint_least16_t、uint_least32_t、uint_least64_t 类型对象的最大值
(宏常量)

UINTPTR_MAX

uintptr_t 类型对象的最大值
(宏常量)

UINTMAX_MAX

uintmax_t 类型对象的最大值
(宏常量)

 调用示例

#include 
#include 

int main()
{
    //int8_t、int16_t、int32_t、int64_t 类型对象的最小值
    std::cout << "INT8_MIN:         " << INT8_MIN << std::endl;
    std::cout << "INT16_MIN:        " << INT16_MIN << std::endl;
    std::cout << "INT32_MIN:        " << INT32_MIN << std::endl;
    std::cout << "INT64_MIN:        " << INT64_MIN << std::endl;
    std::cout << std::endl;

    //int_fast8_t、int_fast16_t、int_fast32_t、int_fast64_t 类型对象的最小
    std::cout << "INT_FAST8_MIN:    " << INT_FAST8_MIN << std::endl;
    std::cout << "INT_FAST16_MIN:   " << INT_FAST16_MIN << std::endl;
    std::cout << "INT_FAST32_MIN:   " << INT_FAST32_MIN << std::endl;
    std::cout << "INT_FAST64_MIN:   " << INT_FAST64_MIN << std::endl;
    std::cout << std::endl;

    //int_least8_t、int_least16_t、int_least32_t、int_least64_t 类型对象的最小值
    std::cout << "INT_LEAST8_MIN:   " << INT_LEAST8_MIN << std::endl;
    std::cout << "INT_LEAST16_MIN:  " << INT_LEAST16_MIN << std::endl;
    std::cout << "INT_LEAST32_MIN:  " << INT_LEAST32_MIN << std::endl;
    std::cout << "INT_LEAST64_MIN:  " << INT_LEAST64_MIN << std::endl;
    std::cout << std::endl;

    //int8_t、int16_t、int32_t、int64_t 类型对象的最大值
    std::cout << "INT8_MAX:         " << INT8_MAX << std::endl;
    std::cout << "INT16_MAX:        " << INT16_MAX << std::endl;
    std::cout << "INT32_MAX:        " << INT32_MAX << std::endl;
    std::cout << "INT64_MAX:        " << INT64_MAX << std::endl;
    std::cout << std::endl;

    //int_fast8_t、int_fast16_t、int_fast32_t、int_fast64_t 类型对象的最大值
    std::cout << "INT_FAST8_MAX:    " << INT_FAST8_MAX << std::endl;
    std::cout << "INT_FAST16_MAX:   " << INT_FAST16_MAX << std::endl;
    std::cout << "INT_FAST32_MAX:   " << INT_FAST32_MAX << std::endl;
    std::cout << "INT_FAST64_MAX:   " << INT_FAST64_MAX << std::endl;
    std::cout << std::endl;

    //int_least8_t、int_least16_t、int_least32_t、int_least64_t 类型对象的最大值
    std::cout << "INT_LEAST8_MAX:   " << INT_LEAST8_MAX << std::endl;
    std::cout << "INT_LEAST16_MAX:  " << INT_LEAST16_MAX << std::endl;
    std::cout << "INT_LEAST32_MAX:  " << INT_LEAST32_MAX << std::endl;
    std::cout << "INT_LEAST64_MAX:  " << INT_LEAST64_MAX << std::endl;
    std::cout << std::endl;

    //intptr_t 类型对象的最小值
    std::cout << "INTPTR_MIN:       " << INTPTR_MIN << std::endl;
    //intmax_t 类型对象的最小值
    std::cout << "INTMAX_MIN:       " << INTMAX_MIN << std::endl;
    //intptr_t 类型对象的最大值
    std::cout << "INTPTR_MAX:       " << INTPTR_MAX << std::endl;
    //intmax_t 类型对象的最大值
    std::cout << "INTMAX_MAX:       " << INTMAX_MAX << std::endl;
    std::cout << std::endl;

    //uint8_t、uint16_t、uint32_t、uint64_t 类型对象的最大值
    std::cout << "UINT8_MAX:         " << UINT8_MAX << std::endl;
    std::cout << "UINT16_MAX:        " << UINT16_MAX << std::endl;
    std::cout << "UINT32_MAX:        " << UINT32_MAX << std::endl;
    std::cout << "UINT64_MAX:        " << UINT64_MAX << std::endl;
    std::cout << std::endl;

    //uint_fast8_t、uint_fast16_t、uint_fast32_t、uint_fast64_t 类型对象的最大值
    std::cout << "UINT_FAST8_MAX:    " << UINT_FAST8_MAX << std::endl;
    std::cout << "UINT_FAST16_MAX:   " << UINT_FAST16_MAX << std::endl;
    std::cout << "UINT_FAST32_MAX:   " << UINT_FAST32_MAX << std::endl;
    std::cout << "UINT_FAST64_MAX:   " << UINT_FAST64_MAX << std::endl;
    std::cout << std::endl;

    //uint_least8_t、uint_least16_t、uint_least32_t、uint_least64_t 类型对象的最大值
    std::cout << "UINT_LEAST8_MAX:   " << UINT_LEAST8_MAX << std::endl;
    std::cout << "UINT_LEAST16_MAX:  " << UINT_LEAST16_MAX << std::endl;
    std::cout << "UINT_LEAST32_MAX:  " << UINT_LEAST32_MAX << std::endl;
    std::cout << "UINT_LEAST64_MAX:  " << UINT_LEAST64_MAX << std::endl;
    std::cout << std::endl;

    //uintptr_t 类型对象的最大值
    std::cout << "UINTPTR_MAX:       " << UINTPTR_MAX << std::endl;
    //uintmax_t 类型对象的最大值
    std::cout << "UINTMAX_MAX:       " << UINTMAX_MAX << std::endl;
    std::cout << std::endl;
    return 0;
}

输出

INT8_MIN:         -128
INT16_MIN:        -32768
INT32_MIN:        -2147483648
INT64_MIN:        -9223372036854775808

INT_FAST8_MIN:    -128
INT_FAST16_MIN:   -32768
INT_FAST32_MIN:   -2147483648
INT_FAST64_MIN:   -9223372036854775808

INT_LEAST8_MIN:   -128
INT_LEAST16_MIN:  -32768
INT_LEAST32_MIN:  -2147483648
INT_LEAST64_MIN:  -9223372036854775808

INT8_MAX:         127
INT16_MAX:        32767
INT32_MAX:        2147483647
INT64_MAX:        9223372036854775807

INT_FAST8_MAX:    127
INT_FAST16_MAX:   32767
INT_FAST32_MAX:   2147483647
INT_FAST64_MAX:   9223372036854775807

INT_LEAST8_MAX:   127
INT_LEAST16_MAX:  32767
INT_LEAST32_MAX:  2147483647
INT_LEAST64_MAX:  9223372036854775807

INTPTR_MIN:       -2147483648
INTMAX_MIN:       -9223372036854775808
INTPTR_MAX:       2147483647
INTMAX_MAX:       9223372036854775807

UINT8_MAX:         255
UINT16_MAX:        65535
UINT32_MAX:        4294967295
UINT64_MAX:        18446744073709551615

UINT_FAST8_MAX:    255
UINT_FAST16_MAX:   65535
UINT_FAST32_MAX:   4294967295
UINT_FAST64_MAX:   18446744073709551615

UINT_LEAST8_MAX:   255
UINT_LEAST16_MAX:  65535
UINT_LEAST32_MAX:  4294967295
UINT_LEAST64_MAX:  18446744073709551615

UINTPTR_MAX:       4294967295
UINTMAX_MAX:       18446744073709551615

你可能感兴趣的:(C++标准库模板(STL)-,类型支持,c++,标准库模板,有符号整数:最小值,有符号整数:最大值,无符号整数:最大值)