uint_fast8_t 的下划线类型可能比单个字节宽,因此 uint_fast8_t b = 0xF0; <<4; isn't determined across different compilers?

问题描述 投票:0回答:1

uint_fast8_t
旨在在目标平台上提供最快的8位(或更宽)整数类型,而
uint8_t
是固定的8位无符号整数类型。

所以

uint_fast8_t b = 0xF0;  b<<4;
不是在不同的编译器之间确定的?

启用 C++11 后会怎样?

c++ c++11 types
1个回答
0
投票

所以 uint_fast8_t b = 0xF0; <<4; isn't determined across different compilers?

是的,即使编译器内部使用 32 或 64 位,它仍然用作 8 位值。编译器仍然知道你的类型,它被明确声明为 8 位值。使用更广泛的寄存器或内存的内部汇编并没有改变程序的语义。

© www.soinside.com 2019 - 2024. All rights reserved.