-
19 votesanswersviews
为什么unsigned short(multiply)unsigned short转换为signed int? [重复]
这个问题在这里已有答案: Implicit type conversion rules in C++ operators 9个答案 为什么 unsigned short * unsigned short 在C 11中转换为 int ? int 太小而无法处理最大值,如此行代码所示 . cout << USHRT_MAX * USHRT_MAX << endl; 在Mi... -
0 votesanswersviews
了解非重载按位运算符的转换顺序,算术转换和整数提升
当编译器遇到非重载操作符以及操作了什么转换时,我想准确理解发生了什么 . 举个例子,让我们采用按位运算符,例如 & . 标准说: [expr.bit.and]执行通常的算术转换;结果是操作数的按位AND功能 . 运算符仅适用于整数或无范围的枚举操作数 . 然后,如果我正在寻找通常的算术转换,我得到: [expr]许多期望算术或枚举类型操作数的二元运算符会以类似的方式引起转换并产生结... -
4 votesanswersviews
在预处理程序指令中评估常量整数表达式时的升级 - GCC
NOTE: 请参阅下面的编辑 . 原始问题: 遇到了一些我无法调和的奇怪行为: #if -5 < 0 #warning Good, -5 is less than 0. #else #error BAD, -5 is NOT less than 0. #endif #if -(5u) < 0 #warning Good, -(5u) is less than 0. #else #er... -
2 votesanswersviews
有符号/无符号的int,short和char
我试图理解代码的输出:http://phrack.org/issues/60/10.html 在此引用它作为参考: #include <stdio.h> int main(void){ int l; short s; char c; l = 0xdeadbeef; s = l; c = ... -
5 votesanswersviews
理解2 ^ 31和-2 ^ 31整数提升
#include <stdio.h> int main() { printf("sizeof(int): %zu\n", sizeof(int)); printf("%d\n", 2147483648u > -2147483648); printf("%d\n", ((unsigned int)...