Is it possible to use dynamic arrays in gpc?
Adriaan van Os
gpc at microbizz.nl
Tue Feb 5 11:13:53 CET 2008
Ohonin Yuriy wrote:
> Hello.
>
> I'm trying to use such a code:
>
> type
> TVar = object
> param1, param2:string;
> ....
> end;
>
> TVarList = object
> Items:array of TVar;
> count:cardinal;
> .....
> end;
>
> In Delphi and FPC it works fine, but in GPC i get an error
>
> 45: warning: missing string capacity -- assuming 255
> 49: error: syntax error before `of'
>
> Is it possible to use dynamic arrays in gpc?
See section [6.2.11.5 EP’s Schema Types including ‘String’] of the gpc manual.
ISO 10206 Extended Pascal feature.
type
RealArray (n: Integer) = array [1 .. n] of Real;
Matrix (n, m: PositiveInteger) = array [1 .. n, 1 .. m] of Integer;
The type ‘RealArray’ in this example is called a Schema with the discriminant ‘n’.
To declare a variable of such a type, write:
var
Foo: RealArray (42);
Regards,
Adriaan van Os
More information about the Gpc
mailing list