Strange GCC short int conversion warning

后端 未结 6 569
南笙
南笙 2021-01-18 15:41

I have a bit of C code, which goes exactly like this:

short int fun16(void){
    short int a = 2;
    short int b = 2;
    return a+b;
}

Wh

6条回答
  •  滥情空心
    2021-01-18 16:26

    When both operands are short, they are implicitly promoted to int in arithmetic operations.

提交回复
热议问题