[net.lang.c] Optimizing

barmar@mit-eddie.UUCP (Barry Margolin) (12/08/85)

In article <628@ttrdc.UUCP> levy@ttrdc.UUCP (Daniel R. Levy) writes:
>In article <10200028@ada-uts.UUCP>, richw@ada-uts.UUCP writes:
>>That is, you tell the compiler to optimize your pi-calculating program
>>and it spews out "3.14159..."
>That would be a marvel of "artificial intelligence" -- an optimizer that
>can recognize algorithms.

Since when is an INTERPRETER considered a "marvel of artificial
intelligence"?  The original didn't say anything about the optimizer
recognizing algorithms.  It merely described an extended form of
constant folding.  A program that doesn't take any input always
generates the same answer, so it can be treated as a constant.

This reminds me of the old story of the optimizing Fortran compiler that
noticed that the program didn't have any output statementsm, so it
generated an object program that didn't bother performing the
computation!
-- 
    Barry Margolin
    ARPA: barmar@MIT-Multics
    UUCP: ..!genrad!mit-eddie!barmar