[Info-vax] decrementing & for loops in C
nobody
nobody at nowhere.com
Thu Jan 8 17:13:02 EST 2009
vaxinf at chemie.uni-konstanz.de wrote:
> Hi,
>
> I tried to run one of the example found on Jim Duff's homepage and
> found a behavior of for loops written in C:
Others have commented about the program not working, so I won't.
Another thing you may experience with some compilers is that the result
will be that both loops go in the same direction no matter what you
write. The reason beeing that an optimizing compiler may realize that
you are not doing anyting inside the loop that forces you to do it in a
special order. Therefore it may choose to turn one of them around in
order to do the execution faster.
I must admit I have never seen this in a C program since I'm really not
a C programmer. But I have seen it in Ada and in Pascal.
Turning off optimization should normally cause the program to execute
your program exactly as written.
/L
More information about the Info-vax
mailing list