It is only a personal preference, not a serious problem.
I would find code in the form of
ArrayLen := IncLength(ArrayName, 1);
to be much more readable then
SetLength(ArrayName, Length(ArrayName)+1);
ArrayLen:= High(ArrayName);
I was just hoping somebody may know how its done.
Thanks - SteveG
On 27/07/14 20:09, Jürgen Hestermann wrote:
Am 2014-07-27 12:10, schrieb Steve Gatenby:
> Could anybody enlighten me on how to make the 'SetLength' procedure
into an equivalent function
> I have many instances of
> SetLength(xxx, Length(xxx)+1);
> Num := High(xxx);
What is the problem with this code?
Why force these 2 commands into a function?
Just to save a little bit of typing?
When *reading* this code it is much
clearer what it does as when reading
Num := IncLength(xxx, 1);
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal