> Andrew Dibley wrote:
>
> > What you are seeing is the result of compiler optimisation.
> > At ASM level a decrement loop is more efficient (1 less subtraction)
> > and the Delphi optimiser will do this for you if it can. So
> > no problem.
>
> It could be when I'd want to test the first element of the array to see if
> it's #10,
> since the loop would miss a line if say High(aBuf) = #13
>
Doubtful. The end result of the optomised code should be exactly the same as
the unoptomised version. Examples where the optomiser produces code which
works differently are very rare - probably because that would be a serious
bug in Borlands compiler and I imagine they spend huge amounts of time and
effort ensuring it doesn't happen!
If your delphi code is such that doing the loop in reverse order must obtain
a different result then the compiler will realise that and won't try. In
this case the compiler will have changed your if statement comparisons to
handle the fact that the loop now goes backwards.
By all means disable optimisation if it will make it easier for you to
understand what is going on while debugging - but it shouldn't alter the end
result.
David Brennan.
DB Solutions Ltd.
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"