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

> By the way, your test of
>
>   if (aBuf[i] = #13) and (aBuf[i+1] = #10) then begin
>
> will cause a read beyond the buffer contents on the last loop
> iteration.

Ouch, you're right. Thanks, I should've noticed that myself.

Best regards,
Sergei

---------------------------------------------------------------------------
    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"

Reply via email to