On Tuesday 05 February 2008 17:13, you wrote:
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
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
Thank you, but will i be able to change array length during runtime in this case? Hear is my goals: I need a list of objects. I need to add a new object to this list at run time. (this could be slow) I need quik access to any object. So it will be no good to use pointers like
type PListElement = ^TListElement; TListElement = object ... next, previos:PListElement; ... end;
Also, what about
45: warning: missing string capacity -- assuming 255