In C, it's legal to write something like:
int foo = +4;
However, as far as I can tell, the unary plus (+
) in +4
is a no-op. Is it?
As per the C90 standard in 6.3.3.3:
The result of the unary + operator is the value of its operand. The integral promotion is performed on the operand. and the result has the promoted type.
and
The operand of the unary + or - operator shall have arithmetic type..