[fpc-pascal] dynamic array contents and system.move

spir ☣ denis.spir at gmail.com
Wed May 5 14:46:54 CEST 2010


On Wed, 5 May 2010 13:44:40 +0200
José Mejuto <joshyfun at gmail.com> wrote:

> The same applies to Pascal, my previous example is badly designed, but
> better than the first one. The problem here is try to use "move" as a
> Pascal way of do things. Move is low level function that should be
> used to optimize code when you known underalying structure, if you do
> not known this one you should copy/move element by element:
> 
> for j:=Low(ArraySource) to High(ArraySource) do
>   TargetArray[j]:=ArraySource[j];

Is this the way one should implement *really* dynamic arrays: in which one can remove or insert elements and still have index and count corrects?
Are there other methods than moving all elements of higher index up or down? If no, is the correct method analog to the above loop? (But inside a unique dynarray)?
Or would it be better to implement such semantics from static arrays directly?

Denis
________________________________

vit esse estrany ☣

spir.wikidot.com



More information about the fpc-pascal mailing list