Silvio a Beccara wrote:
Frank: thank you for your explanations.
Coming from Kylix, I've never used vectors with pointers before. Could you give me an example routine for declaring and referencing-dereferencing this objects? I would need, besides vectors, also matrices up to 3 (M x N x P elements) dimensions.
Roughly (untested):
type PMatrix = ^TMatrix; TMatrix (m, n, p: Integer) = array [1 .. m, 1 .. n, 1 .. p] of Real;
var Matrix: PMatrix;
[...]
New (Matrix, m0, n0, p0); Matrix^[i, j, k] := 4.2e1; Dispose (Matrix);
(BTW, for such things please use the latest version of GPC. I've fixed some bugs regarding schemata with multiple discriminants recently.)
Also, could I simply declare a schema in the main program, and then call all procedures from it with a normal statement (e.g. merce (Vett) ), like in the GPC demo program about schemata?
Yes. There's only one technical difference: Such variables are placed on the stack, not the heap. If they are large (say, more than a few MB in total), you might run into conflicts with your system's stack limits.
Frank