Theory of Pure C, chapter 937

utzoo!decvax!harpo!ihnp4!iwsl1!deg utzoo!decvax!harpo!ihnp4!iwsl1!deg
Thu Jan 6 12:21:05 AEST 1983

 foo( x++ * x )

Data: (according to "The C Programming Language" K&R)
 p. 185: "expressions involving a commutative and associative
	operator ( *,+,&,|,^) may be rearranged arbitrarily by the
	so the x++ may be evaluated before or after the other x

 p. 187: "[for postfix ++] After the value is noted, the III) evaluate x (second x)
     evaluate x (first x)
     pass value of X*X to function
     after function returns store X+1 in x
     (if foo changes x, the change is lost)
     (This would require a bizzare compiler, but, I think, is legal)

I think all other possible linearizations produce one of the
above results.

David Good

More information about the Comp.lang.c mailing list