[fpc-devel] The slice function and bug #2856
Peter Vreman
peter at freepascal.org
Thu Oct 13 11:49:42 CEST 2005
> Hi All
> As you now, the Slice function (internal to the Delphi compiler) is not
> currently implented in fpc (see bug
> http://www.freepascal.org/bugs/showrec.php3?ID=2856). I am wondering how
> easy it is to implement/circumvent this problem. In these regard, can
> someone shed light on the following two things:
>
> 1. Are open array parameters in fpc functions and procedure implemented in
> the same way as in Delphi. That is,
>
> procedure MyFunc(x: array of integer)
>
> is actually compiled as
>
> procedure MyFunc(count: Integer; x: ^Integer)
>
> and inside MyFunc, x is treated as a zero based arrays of size count, and
> count is only accessible through High(x).
>
> Are fpc open arrays done in the same way?
Yes
> 2. What is the internal structure of a dynamic array/open array in fpc.
> Maybe, given a pointer and a array size, one can hack a temprorary dynamic
> array structure (probably without typecasting) and pass it as an open
> array parameter. Even without typecasting, this will let me compile
> existing delphi code.
See rtl/inc/dynarr*.inc
More information about the fpc-devel
mailing list