Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!henry From: henry@utzoo.UUCP (Henry Spencer) Newsgroups: comp.lang.c Subject: Re: Optimizing Floating-Point Expression Evaluation Message-ID: <7919@utzoo.UUCP> Date: Thu, 16-Apr-87 11:52:52 EST Article-I.D.: utzoo.7919 Posted: Thu Apr 16 11:52:52 1987 Date-Received: Thu, 16-Apr-87 11:52:52 EST References: <16646@sun.uucp> Organization: U of Toronto Zoology Lines: 20 Keywords: float point expression > ... optimizing compilers should be designed to > improve carefully-written code by means that can not be readily expressed > in the source language. I would have thought that most experienced C > programmers would agree with that proposition, but some recent postings > suggest otherwise: that a major purpose of optimizing compilers is to clean > up after careless coders and thereby encourage careless coding. Not quite. The correct statement is that a major purpose of optimizing compilers is to do machine-specific optimizations on machine-independent code. In C in particular, it is possible to express many optimizations in the source code. Unfortunately, when one does this, one often makes the code more efficient on one machine at the cost of making it less efficient on others. Sometimes, in fact, one makes it more efficient on one machine at the cost of making it unrunnable on others. Almost always one makes it more efficient on one machine at the cost of making it less readable to human beings. One legitimate role of optimizing compilers is to remove the need for such penny-wise-pound-foolish "optimization". -- "We must choose: the stars or Henry Spencer @ U of Toronto Zoology the dust. Which shall it be?" {allegra,ihnp4,decvax,pyramid}!utzoo!henry