On 2017-08-20 06:04, cfbsoftware@gmail.com wrote:
P.S. Using pointers for all the matrices also has the advantage in
that you can write generic code that handles 2-D arrays of any size
It's too bad this cannot be done in standard Oberon. Of course you can
use open (one-dimensional) arrays and calculate element indices manually
but then you also need to pass the number of columns for each matrix.
On 2017-08-20 22:59, August Karlstrom wrote:
It's too bad this cannot be done in standard Oberon. Of course you can
use open (one-dimensional) arrays and calculate element indices manually but then you also need to pass the number of columns for each matrix.
I was wrong here; Oberon actually does support open arrays of any dimension.
My first reaction was to disagree but I now see that you are right.
The syntax does allow e.g. for a three-dimensional open array parameter:
PROCEDURE P(VAR a: ARRAY OF ARRAY OF ARRAY OF INTEGER);
My next question then was how would you know the length of each dimension but I suppose (?) it is just:
Dimension 0: LEN(a)
Dimension 1: LEN(a[0]);
Dimension 2: LEN(a[0, 0] or LEN(a[0][0])
Do you know of any current Oberon compilers that support open arrays that are not restricted to 1 dimension?
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 296 |
Nodes: | 16 (2 / 14) |
Uptime: | 37:02:33 |
Calls: | 6,648 |
Calls today: | 3 |
Files: | 12,193 |
Messages: | 5,329,127 |