C "optimization"

Joseph S. D. Yao jsdy at hadron.UUCP
Thu Nov 21 06:25:05 AEST 1985


One of the original purposes of the C compiler was to compile
a then-obscure operating system on the PDP-7 and PDP-11.  In
device drivers for this OS, some routines read like:
	send(c)
	{
		LPADDR->word = WRITE | GO;
		LPADDR->word = c;
		c = LPADDR->word;
		return(c);
	}
or words to that effect.  I would get quite upset if optimising
this led to:
	send(c)
	{
		return(LPADDR->word = c);
	}
Remember, this was before we had implemented compilers with the
"const" and "var" keywords.  (Oh, you mean it's still before?
Re-calibrate that wayback, would you, Sherman?)

I think my memory on that other keyword is wrong, but I'll post
this anyway for the general content.
-- 

	Joe Yao		hadron!jsdy at seismo.{CSS.GOV,ARPA,UUCP}



More information about the Comp.lang.c mailing list