Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!apple!sun-barr!newstop!sun!imagen!qmsseq!pipkins From: pipkins@qmsseq.imagen.com (Jeff Pipkins) Newsgroups: comp.sys.ibm.pc.programmer Subject: Re: No Aliasing Compile Option Keywords: Microsoft 6.0 C update woes Message-ID: <134@qmsseq.imagen.com> Date: 24 May 90 22:29:26 GMT References: <4886@daffy.cs.wisc.edu> <26547195.F69@tct.uucp> <1990May19.141401.4350@ux1.cso.uiuc.edu> <265861D7.3293@tct.uucp> Reply-To: pipkins@qmsseq.UUCP (Jeff Pipkins) Organization: QMS Inc., Mobile, Alabama Lines: 34 My two cents worth (an inflated price, at that): 1. Because of the design of the C language, it is not possible for a C compiler to completely detect all aliasing situations ("not possible" means without spending potentially infinite amounts of time simulating the code, of course). Other languages have been designed specifically so that the compiler can detect aliasing. Unfortunately, this requires constraints on the language that are so severe that the language becomes unsuitable for professional use. The "cost" is too high. 2. It is not "wrong" to use aliasing, either morally or legally, and it is not generally considered bad practice. Since I used the word "morally", this is obviously my opinion. 3. Why is this compiler option there, anyway? Because the compiler writer says to himself (while writing the compiler), "DAMN! If I could just make this one little ASSumption, I could produce tighter code! Wouldn't that be nifty?!!" But he knows that it is an UNSAFE optimization. But he still can't resist. It would be so neat. So he adds it as an option. POINT: Not only should the option not be used to compile benchmarks, IT SHOULD NOT EVEN BE AN AVAILABLE OPTION FOR THE COMPILER IN THE FIRST PLACE! Unsafe optimizations are just that -- unsafe. The option is there because the compiler writer couldn't resist the temptation, and now he is passing the temptation on to the user of the compiler by encouraging him to use an unsafe option. Tell me, how do you guarantee that the option doesn't break your code? Tell me how you have insured it is safe -- by looking at it? How do you test for that? If it doesn't run correctly, does it matter that it runs faster? The only thing that should be done with unsafe optimizations is to omit them. Jeff Pipkins pipkins@imagen.com