Re: array with same value all the time?




alanglloyd@xxxxxxx wrote:
I can't see any problem with this, OTOH I think it would be much
clearer to code ...

{ delete used data }
for i := 0 to Length(AData) - iUsedData - 1 do
aData[i] := aData[iUsedData + i];
SetLength(aData, Length(aData) - iUsedData);

... but maybe its how I look at shuffling bytes. <g>


It is an old habit of mine to do so. The point is that Decrementing is
faster than Incrementing - it probably does not do much of a difference
here, but I try to do so all the time, as it might help me some day.
Actually Delphi counts down to in for loops, where the var itself is
not used, cause it is faster.

BR
Sonnich

.



Relevant Pages

  • Re: array with same value all the time?
    ... Sonnich wrote: ... clearer to code ... ... SetLength- iUsedData); ... but maybe its how I look at shuffling bytes. ...
    (comp.lang.pascal.delphi.misc)
  • Re: array with same value all the time?
    ... I can't see any problem with this, OTOH I think it would be much ... clearer to code ... ... SetLength- iUsedData); ... Alan Lloyd ...
    (comp.lang.pascal.delphi.misc)