[fpc-devel] The slice function and bug #2856

Peter Popov ppopov at tamu.edu
Thu Oct 13 09:40:15 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?

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.

Thanks
Peter

-- 
****************************************************
Peter Popov
Postdoctorial Research Assistant,
Institute for Scientific Computation
Texas A&M University, College Station, TX 77843
Off: (979) 458-4644
Email: ppopov at tamu.edu
****************************************************



More information about the fpc-devel mailing list