[fpc-pascal] Array slices
Christos Chryssochoidis
c.chryssochoidis at gmail.com
Sun Nov 11 14:36:17 CET 2007
Hello all,
A while ago in one of the FPC lists I had read that FPC 2.2.0
supports array slices. So I made a program to test this feature:
> program Test_Slices;
>
> procedure Test(C : array of Integer);
> begin
> end;
>
> var
> A : array of Integer;
> B : array of Integer;
>
> begin
> setLength(A,6);
> Test(A[2..4]); // This works
> setlength(B,6);
> // B := A[4..6] // Compilation error if I uncomment this line
> end.
The above code, as it is, compiles without problem. However if I
uncomment the last line, I get a compilation error:
> ChristosComputer:~/workspace/pascal christoschryssochoidis$ fpc
> Test_Slices.pas
> Free Pascal Compiler version 2.2.0 [2007/08/30] for i386
> Copyright (c) 1993-2007 by Florian Klaempfl
> Target OS: Darwin for i386
> Compiling Test_Slices.pas
> Fatal: Compilation aborted
> An unhandled exception occurred at $0010401C :
> EAbstractError : Abstract method called
> $0010401C
> $0013334D
> $00133098
> $00129879
> $00129879
> $0012A94C
> $0010401C
> $000DCD87
> $000C13ED
> $0001B5F5
>
> Error: /usr/bin/ppc386 returned an error exitcode (normal if you
> did not specify a source file to be compiled)
> ChristosComputer:~/workspace/pascal christoschryssochoidis$
Are array slices only supported as arguments to subprograms calls?
I 'm using FPC 2.2.0 on Mac OS X Intel.
Thanks very much in advance,
C.C.
More information about the fpc-pascal
mailing list