[fpc-pascal] Delphi mode syntax error
Marco van de Voort
marcov at stack.nl
Tue Jan 19 15:14:08 CET 2010
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.
More information about the fpc-pascal
mailing list