gm2
[Top][All Lists]
Advanced

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

Re: Dynamic mutidimensional arrays


From: Fischlin Andreas
Subject: Re: Dynamic mutidimensional arrays
Date: Wed, 5 Apr 2023 08:44:04 +0000

See below

On Wed, 05.04.23, at 10:04, Benjamin Kowarsch <trijezdci@gmail.com> wrote:

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.

This is why you need to abstract the type and export PVECTOR or better TYPE Vector; opaque from a DEFINITION MODULE.


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.

Yes. I was just commenting on YOUR code, not mine.

Andreas



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

Attachment: smime.p7s
Description: S/MIME cryptographic signature


reply via email to

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