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"
- Re: [DUG]: Number of lines in text f... Neven MacEwan
- [DUG]: IDE behaviour Rohit Gupta
- [DUG]: TTreeView Rohit Gupta
- Re: [DUG]: TTreeView Steve Peacocke
- [DUG]: Calculated Fields Rohit Gupta
- RE: [DUG]: Number of lines in text file Sergei Stenkov
- Re: [DUG]: Number of lines in text file Neven MacEwan
- RE: [DUG]: Number of lines in text file Sergei Stenkov
- Re: [DUG]: Number of lines in text file Phil Scadden
- RE: [DUG]: Number of lines in text file Andrew Dibley
- Re: [DUG]: Number of lines in text file Sergei Stenkov
- Re: [DUG]: Number of lines in text file David Brennan
- [DUG]: Array - deleting an element Damien Long
- RE: [DUG]: Number of lines in text file Andrew Dibley
- RE: [DUG]: Number of lines in text file Sergei Stenkov
- RE: [DUG]: Number of lines in text file Steve Peacocke
- RE: [DUG]: Number of lines in text file Sergei Stenkov
- RE: [DUG]: Number of lines in text file Steve Peacocke
