In our previous episode, Jonas Maebe said:
> I also don't see any advantage to using a pointer instead of a dynamic  
> array directly. It will not be faster in any way, since there are no  
> uniqueness checks for dynamic arrays. In fact, it will probably be  
> slower, since you now have two variables in use: one to hold a  
> reference to the dynamic array, and one for the extra pointer.

Hmm, under delphi at least, it is cheaper to do

var pstart,pend : PSomeType;

if length(sometypedynarray)>0 then
  begin
    pstart:=...@sometypedynarray[0];
    peind :=...@sometypedynarray[length(sometypedynarray)-1];
    while (pstart<=peind) do
      begin
        operate_on(pstart);  
        inc(pstart);
      end;
  end;

then for i over a dynarray, even if sometype is a simple type.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to