C++ 是否保证 cstdint sizeof 的顺序?

Does the C++ guarantee an ordering of cstdint sizeof?

C++ 标准是否保证:

sizeof(uint8_t) <= sizeof(uint16_t) <= sizeof(uint32_t) <= sizeof(uint64_t)
sizeof(uint_least8_t) <= sizeof(uint_least16_t) <= sizeof(uint_least32_t) <= sizeof(uint_least64_t)
sizeof(uint_fast8_t) <= sizeof(uint_fast16_t) <= sizeof(uint_fast32_t) <= sizeof(uint_fast64_t)

如果没有,它提供什么保证? (欢迎从标准中摘录)

第一个是有保证的,前提是这些类型存在。 (如果系统不能提供它们可能不存在)。

第二个 least 是有保证的。这是未签名案例的文本(签名文本类似):

The typedef name uint_leastN_t designates an unsigned integer type with a width of at least N, such that no unsigned integer type with lesser size has at least the specified width.

第三个,fast:好像没有具体说明,但是写着:

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

如果我们假设这段文字是按字面意思理解的,那么它就可以保证;尽管相关的脚注表明编译器有更多的自由度。尽管如此,一个实现似乎不太可能做一些事情,比如让 fast16_t 成为 64 位,并且 fast32_t 成为 32 位。

注意。这些引用来自 ISO C99,C++ 标准引用这些定义。