Excessive optimization (was Re: what was VMS/OpenVMS written in?)
cisin at xenosoft.com
Fri Dec 3 16:42:11 CST 2010
> > I'm afraid I must disagree. What if, for my own nefarious purposes, I
> > need the N microseconds of delay achieved via the "spurious" for loop?
On Fri, 3 Dec 2010, Richard wrote:
> Put that code in a compilation unit that is compiled with
> optimizations turned off.
Going way back to where this thread first forked off, . . .
Microsoft's first optimizing C compiler DID NOT provide any simple way
to turn optimizations off. I've heard of a few other first attempts at
optimizing compilers that did likewise.
The repercussions were that the next version of that compiler added the
capability of turning off optimizations. (also s'posedly typical of
second attempts at optimizing compilers)
Whether a programmer or a compiler produce better code would seem to
depend on how well one can get the compiler to understand all of the
details of what one WANTS the code to do, and just how weird THAT might
be. Some things, such as deliberately wasting time, or polling a memory
location that is influenced externally, need additional explanation for
the compiler to understand not to optimize them out.
Grumpy Ol' Fred cisin at xenosoft.com
More information about the cctech