Re: Egcs 1.0.3 & Linux

Stephen Williams (steve@icarus.icarus.com)
Tue, 19 May 1998 09:17:03 -0600


> #include <stdio.h>
> int a=0;
> int f(void) { a=1;return 1; }
> void main(void) { printf("%d",f()+a); }

chris@cybernet.co.nz said:
> I was under the impression that in the case of equal operator
> precedence the order was defined to be strictly left to right, so in
> this case it should return 2 and never 1.

There is nothing in the standard that says a must be evaluated before
b in (a+b). What it says is that (a+b) must be evaluated before a+b+c
can be evaluated. It is even legitimate in the latter case for c to be
evaluated before a, but it cannot be added to a, it must be added to (a+b).

Right?

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu