Broken compilers? (was Re: Comma Operator)

Chris Torek chris at mimsy.UUCP
Mon Jan 16 01:41:48 AEST 1989


->	printf("%d %d %d\n", (x = 1, y = 2), x, y);

In article <1904 at buengc.BU.EDU> bph at buengc.BU.EDU (Blair P. Houghton) writes:
-A while back, someone indicated that they knew of a compiler optimizer
-that would reduce something such as the above (ostensibly through
-constant-reduction) to
-
-printf("%d %d %d\n", (1,2), x, y);
-
-or maybe even
-
-printf("%d %d %d\n", 2, x, y);
-
-So, you compiler-writing C-programmers, is this thing broken or what?

Quite thoroughly, unless both x and y are `dead'.

The side effect(s), if any, of any expression that occurs anywhere
may not be arbitrarily deleted.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at mimsy.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.lang.c mailing list