What is the purpose of the unary plus (+) operator in C?

前端 未结 8 2100
攒了一身酷
攒了一身酷 2020-11-28 05:58

In C, it\'s legal to write something like:

int foo = +4;

However, as far as I can tell, the unary plus (+) in +4

8条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-28 06:48

    By 'no-op', do you mean the assembly instruction?
    If so, then definitely not.

    +4 is just 4 - the compiler won't add any further instructions.

提交回复
热议问题