Toy compilers (was Re: gotos)

Robert Firth firth at sei.cmu.edu
Wed May 4 05:16:28 AEST 1988


In article <1080 at maynard.BSW.COM> campbell at maynard.UUCP (Larry Campbell) writes:
>P.S. -	I just compiled a "while (1)" loop on my system, which has one
>	of the wimpier C compilers around.  It generated the right code
>	(i.e., no test instructions, just a jump to the top of the loop).

Same here.  I compiled the BCPL equivalent

	WHILE TRUE DO
	{
	  Thing
	}

and got out

    LA4:
	code for Thing
	BRB LA4

This is so obvious a micro optimisation I find it hard to believe any
compiler won't do it.



More information about the Comp.lang.c mailing list