[fpc-pascal] function Copy is inconsistent with Delphi
Michael Van Canneyt
michael.vancanneyt at wisa.be
Tue Jan 16 11:36:41 CET 2007
On Tue, 16 Jan 2007, Alexander Todorov wrote:
> Hello,
> i am converting a big Delphi project a part of uses a lexical parser.
> It is dependent on the Copy function which in Delphi is declared:
>
> function Copy(S; Index, Count: Integer): string;
>
> and in FPC it is:
>
> function Copy(const s: string; FromPosition, ToPosition : integer): String;
>
>
> Why there are different declarations? I see that the FPC variant is
> used in a lot of places and it is not likely that it will be changed
> to be compatible with Delphi.
As far as I know, The Delphi variant is used also to copy dynamic arrays,
possibly also variant arrays. The above function is a dummy declaration,
as found in the documentation - because in reality it is handled by
internal system functions (you can search for _copy, _copyvar _objCopy
etc. in the system unit of delphi).
However, for strings, the behaviour should be the same.
For dynamic arrays, I don't think FPC has a similar function.
Michael.
More information about the fpc-pascal
mailing list