[Info-vax] decrementing & for loops in C

Johnny Billquist bqt at update.uu.se
Mon Jan 12 17:27:23 EST 2009


Tim E. Sneddon skrev:
> Bill Gunshannon wrote:
>> In article <49667A6E.3050507 at nowhere.com>,
>>     nobody <nobody at nowhere.com> writes:
>>> Turning off optimization should normally cause the program to execute 
>>> your program exactly as written.
>>
>> A program should always execute exactly as written.  No machine is smart
>> enough to second guess the intent of a human.
>>
> 
> That is arguable. After your code has been optimised
> it doesn't quite execute 'exactly as written'. The
> end result might be 'exactly as written'. However, the
> path to get there has been completely shuffled around
> by the compiler.

Um. Since code is *never* exactly executed as written (with a very few number of 
exceptions being assembler, or whatever language the processor executes in 
"hardware"), an optimizer isn't doing anything new compared to what the compiler 
itself is doing. The optimizer is just trying to improve the result made by the 
compiler, which have already transformed the source code in some "magic" way 
into something else.
The programmer can only hope that the result from running the compiled program 
will match what he believe he expressed in his source code.

Stop being obnoxious about optimizers. Or else, stop using a compiler all together.

	Johnny

-- 
Johnny Billquist                  || "I'm on a bus
                                   ||  on a psychedelic trip
email: bqt at softjar.se             ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol



More information about the Info-vax mailing list