[fpc-pascal] Array slices
Daniël Mantione
daniel.mantione at freepascal.org
Sun Nov 11 14:41:02 CET 2007
Op Sun, 11 Nov 2007, schreef Christos Chryssochoidis:
> Hello all,
> =
> A while ago in one of the FPC lists I had read that FPC 2.2.0 supports ar=
ray
> 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 :=3D A[4..6] // Compilation error if I uncomment this line
> > end.
> =
> The above code, as it is, compiles without problem. However if I uncommen=
t the
> last line, I get a compilation error:
=
> Are array slices only supported as arguments to subprograms calls?
> I 'm using FPC 2.2.0 on Mac OS X Intel.
At this time: yes, you can pass only to open arrays. In the future, the =
above construction will be supported. It is of course not correct that =
this causes a compiler crash and this is a bug.
Dani=EBl
More information about the fpc-pascal
mailing list