order of parsing expressions
Hi guys, I come across a really confusing problem. I have a function as below:
Very simple. But from a snapshot of the local variables, i see:
It doesn't match what I'm expect. It should be b = 0 - 50 -2*50 = -150 right? Also wrong for c = 0 - 50 + 2*50 = 50
It becomes correct if i parenthesize each product term, as below
But this should not be necessary. It seems the compiler evaluates an expression from right to left, which seems awkward. Do you have any ideas about this?