gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dynamic mutidimensional arrays


From: Benjamin Kowarsch
Subject: Re: Dynamic mutidimensional arrays
Date: Wed, 5 Apr 2023 17:04:45 +0900

Hi

On Wed, 5 Apr 2023 at 16:49, Fischlin Andreas wrote:

TYPE  PVECTOR = POINTER TO ARRAY [1..MaxV] OF REAL;

But then all your vectors have to be of the same length even though you could use that type just as well for any vector with a length up to MaxV.

I would rather put that array declaration into a record type and add a length field.

TYPE Vector = POINTER TO RECORD
  length : CARDINAL;
  values : ARRAY [1..MaxV] OF REAL
END; (* Vector *)

Statically declared, dynamically allocated, dynamically bounded.

This way you can use it for vectors of different sizes as long as the length doesn't exceed MaxV.

PS: All uppercase identifiers should probably be avoided ;-)

regards
benjamin

reply via email to

[Prev in Thread] Current Thread [Next in Thread]