Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!gatech!bloom-beacon!mit-eddie!ll-xn!ames!ptsfa!ihnp4!inuxc!iuvax!pur-ee!uiucdcs!uxc.cso.uiuc.edu!uiucuxe!mcdonald
From: mcdonald@uiucuxe.cso.uiuc.edu
Newsgroups: comp.lang.fortran
Subject: Re: Array storage order
Message-ID: <50500005@uiucuxe>
Date: Sat, 4-Jul-87 14:20:00 EDT
Article-I.D.: uiucuxe.50500005
Posted: Sat Jul  4 14:20:00 1987
Date-Received: Tue, 7-Jul-87 06:50:19 EDT
References: <105@anumb.UUCP>
Lines: 28
Nf-ID: #R:anumb.UUCP:105:uiucuxe:50500005:000:1173
Nf-From: uiucuxe.cso.uiuc.edu!mcdonald    Jul  4 13:20:00 1987


> We're trying to arrange for a C subroutine library to be callable from
> Fortran and Pascal and also transportable between machines. 
> 
> One of the questions that has come up is with respect to the storage
> order of 2-dimensional arrays. In C, array element [1][2] is stored
                                    ^
                                    ! 
In case you haven't been following comp.lang.c recently, there
is a problem using subroutine libraries of routines which have variable
dimensions. The problem is that arrays can't be declared with dimensions
which aren't constants. At least in C you can use pointers and get the 
results you want; the code just looks messy and isn't ANYWHERE NEAR as
readable as Fortran.

> The pascal I haven't investigated yet.
        ^
        !
In old fashioned, standard Pascal the problem is, I believe, worse yet.
In Pascal, arrays of different sizes are DIFFERENT TYPES, and Pascal
being arrogantly strong-typed, all you can get is errors. In some cases
compiler vendors get around this by making "extensions".

Thus the "transportable between machines" may not be generally achievable.

Doug McDonald

(mcdonald@uiucuxe)