Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!cbatt!ihnp4!cuae2!ltuxa!we53!sw013b!dj3b1!killer!jfh From: jfh@killer.UUCP Newsgroups: comp.arch,comp.lang.c Subject: Re: Optimization vs. the programmer Message-ID: <761@killer.UUCP> Date: Thu, 9-Apr-87 16:03:09 EST Article-I.D.: killer.761 Posted: Thu Apr 9 16:03:09 1987 Date-Received: Sun, 12-Apr-87 01:25:08 EST References: <479@danews.ATT.COM> <16294@sun.uucp> Organization: The Unix(tm) Connection, Dallas, Texas Lines: 35 Xref: utgpu comp.arch:831 comp.lang.c:1558 Summary: But have you seen what the optimizers do? The request seems fairly obvious to me. One writer wrote about how his line n = n; was necasary for the hardware to work. I have seen compilers drop that one on the floor. There was also some discussion about adding a new storage class to C named 'volatile' or some so that references of this seemingly weird type aren't ignored. The device driver code for some hardware requires you to read from a silo more than one time to get the desired peice of information. If I write status = *silo; status = *silo; on a real *smart* compiler, the second assignment may never happen. I might get real clever and write status = *silo; status = 0; status = *silo; only to find the first two lines dropped. If I am stupid enough to write n = n; The compiler should be smart enough to code the turkey. Compilers are for compiling, program verifiers are for 'picking the peices of fluff' from your programs. - John. Disclaimer: I hold you entirely responsible for what I write.