Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uflorida!mephisto!mcnc!uvaarpa!murdoch!astsun7.astro.Virginia.EDU!gl8f From: gl8f@astsun7.astro.Virginia.EDU (Greg Lindahl) Newsgroups: comp.lang.misc Subject: Re: The Forbiden Message-ID: <1990Aug16.204409.4744@murdoch.acc.Virginia.EDU> Date: 16 Aug 90 20:44:09 GMT References: <24279@megaron.cs.arizona.edu> Sender: news@murdoch.acc.Virginia.EDU Organization: Department of Astronomy, University of Virginia Lines: 32 In article <24279@megaron.cs.arizona.edu> gudeman@cs.arizona.edu (David Gudeman) writes: >In article <6465@helios.ee.lbl.gov> austern@ux5.lbl.gov (Matt Austern) writes: >>The more assumptions a compiler can make about a program, the better >>it can do the optimization, and in many cases, the only way a compiler >>can safely assume that a programmer doesn't do something is to make it >>illegal. > >This is the assumption that I find obviously false. Try this for an example: FORTRAN doesn't allow aliased arguments in subroutine calls. This allows FORTRAN compilers to make all sorts of nice optimizations. Although it is possible to insert run-time checks to make sure aliasing doesn't happen, IF the programmer declared the array to the proper size in the subroutine, I have yet to meet a compiler which does so. I might also note that the Convex vectorizing C compiler has a switch which allows the compiler to assume that arguments are not aliased. Again, no run-time check is available, but it is theoretically possible. I'd write valid programs and like it when they run fast. I like compilers that can warn me of invalid programs at compile or run-time, but I hate compilers which skip optimizations because it might trip an invalid program. I'll debug where I have good compilers, and run where the machine is fast. If I'm using C, I'm willing to write with the restriction of no aliasing. -- "In fact you should not be involved in IRC." -- Phil Howard