The difference of int8_t, int_least8_t and int_fast8_t?

前端 未结 5 1522
感情败类
感情败类 2020-11-27 03:07

What is the difference between the int types int8_t, int_least8_t and int_fast8_t?

5条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-27 03:47

    From the spec section 7.8.1.1 Exact-width integer types, paragraph 1:

    The typedef name intN_t designates a signed integer type with width N , no padding bits, and a two’s complement representation. Thus, int8_t denotes a signed integer type with a width of exactly 8 bits.

    And from: 7.18.1.2 Minimum-width integer types, paragraph 1:

    The typedef name int_leastN_t designates a signed integer type with a width of at least N, such that no signed integer type with lesser size has at least the specified width. Thus, int_least32_t denotes a signed integer type with a width of at least 32 bits.

    And finally from 7.18.1.3 Fastest minimum-width integer types, paragraph 2:

    The typedef name int_fastN_t designates the fastest signed integer type with a width of at least N. The typedef name uint_fastN_t designates the fastest unsigned integer type with a width of at least N.

提交回复
热议问题