Does Unary + operator do type conversions?

后端 未结 4 642
眼角桃花
眼角桃花 2021-01-04 04:28

Till now I was believing that there is no use of unary + operator.

But then I came across with following example:

char ch;
short sh;
in         


        
4条回答
  •  春和景丽
    2021-01-04 05:05

    It's not sizeof, it's the unary + itself. The operands of unary + undergo "the usual arithmetic conversions". See, e.g., this other answer involving ordinary addition.

提交回复
热议问题