What does the C++ standard state the size of int, long type to be?

前端 未结 24 2218
无人及你
无人及你 2020-11-21 04:42

I\'m looking for detailed information regarding the size of basic C++ types. I know that it depends on the architecture (16 bits, 32 bits, 64 bits) and the compiler.

24条回答
  •  一整个雨季
    2020-11-21 04:46

    Updated: C++11 brought the types from TR1 officially into the standard:

    • long long int
    • unsigned long long int

    And the "sized" types from

    • int8_t
    • int16_t
    • int32_t
    • int64_t
    • (and the unsigned counterparts).

    Plus you get:

    • int_least8_t
    • int_least16_t
    • int_least32_t
    • int_least64_t
    • Plus the unsigned counterparts.

    These types represent the smallest integer types with at least the specified number of bits. Likewise there are the "fastest" integer types with at least the specified number of bits:

    • int_fast8_t
    • int_fast16_t
    • int_fast32_t
    • int_fast64_t
    • Plus the unsigned versions.

    What "fast" means, if anything, is up to the implementation. It need not be the fastest for all purposes either.

提交回复
热议问题