Michael Michael - 11 months ago 62
C++ Question

What does the compiler do here: int a = b * (c * d * + e)?

I had a strange bug in my program, and after a few hours of debugging, I found the following very stupid line:

int a = b * (c * d * + e)

If you don't see it: Between
I wrote
* +
, where just a
was intended.

Why does this compile and what does it actually mean?

Answer Source

The + is interpreted as an unary plus operator. It simply returns the promoted value of its operand.