Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site hadron.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!rlgvax!hadron!jsdy From: jsdy@hadron.UUCP (Joseph S. D. Yao) Newsgroups: net.lang.c Subject: Re: C "optimization" Message-ID: <85@hadron.UUCP> Date: Wed, 20-Nov-85 15:25:05 EST Article-I.D.: hadron.85 Posted: Wed Nov 20 15:25:05 1985 Date-Received: Sat, 23-Nov-85 09:52:59 EST References: <2539@sjuvax.UUCP> Reply-To: jsdy@hadron.UUCP (Joseph S. D. Yao) Distribution: net Organization: Hadron, Inc., Fairfax, VA Lines: 25 Summary: Mindless optimisation sometimes hurts. 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@seismo.{CSS.GOV,ARPA,UUCP}