comp.lang.ada
 help / color / mirror / Atom feed
From: stt@spock.camb.inmet.com (Tucker Taft)
Subject: Re: Interfaces.Ada
Date: Wed, 2 Nov 1994 06:24:06 GMT
Date: 1994-11-02T06:24:06+00:00	[thread overview]
Message-ID: <CyMn46.8HB@inmet.camb.inmet.com> (raw)
In-Reply-To: 396agd$9bt@network.ucsd.edu

In article <396agd$9bt@network.ucsd.edu>,
Matt Kennel <mbk@inls1.ucsd.edu> wrote:

>Michael Feldman (mfeldman@seas.gwu.edu) wrote:
>: >will work)?  I am using Sun Sparc.  Thank you.
>
>: I think Robert Dewar has commented on the best way (currently) to
>: interface Fortran programs to GNAT. Interfaces.Fortran, and especially
>: the data structures interface - which will provide column-mapped
>: multi-dimensional arrays, etc. simply has not been implemented yet.
>
>I've always wondered about one thing:
>
>  When people make new langauges why do they implement the C storage
>  layout for multi-dimensional arrays instead of that of Fortran?  E.g.
>  as it seems, Ada9x, Modula-3.

Note that Ada doesn't "implement the C storage layout" for
arrays.  Ada 83 doesn't specify the order.  However, implementors
naturally have chosen the layout implied by the way that
array aggregates are written, where the second index varies
fastest as you move through memory.  

For example, in the following array aggregate:

    ((1,2,3), (4,5,6), (7,8,9))

One would naturally expect the second dimension to vary
fastest, by just looking at the syntax for the aggregate.
But to reiterate, there is nothing in Ada 83 that requires
a particular layout.

In Ada 9X, the Convention pragma may be used to specify 
Fortran-style array layout.

Also, it is a bit funny to call the non-Fortran order the
"C storage layout" for multi-dimensional arrays.  C was
certainly not the first language to vary the last dimension
fastest.  Algol 60 used the non-Fortran order (or at least suggested
it in the same sense that Ada's array aggregate notation
suggests it).  So it has a long history, though clearly not
as relevant a history as Fortran's choice to modern numerics.

It is also of course possible to simply reverse the indices
when defining and using a multidimensional array in an implementation
that has the non-Fortran order, so it doesn't seem like
an insurmountable barrier in any case.

>  Given that most matrix algorithms are in Fortran why be backwards?  (and
>  ones in C usually use some sort of non-compatible dope-vector thing anyway
>  because C doesn't have variable matrix sizes.)

Calling the non-Fortran order "backwards" reminds me of the
typical non-Britisher comment about the "backwards" nature
of the British drive-on-the-left rule ;-).

>  Why not make the default just like Fortran?  I don't think one way is
>  particularly more "natural" than the other so now that Fortran chose one
>  convention why not stay with it?

The array aggregate notation suggests that the non-Fortran order
is somewhat more natural in Ada.

>  The only thing I can figure out is that it is a childish attitude
>  like "bleah fortran sucks so we'll be different".  I don't believe this
>  is true so what is the real reason?  Is it that compelling?

It didn't come out of any desire to be different.  I believe it
was simply that Ada comes more from the Algol school of languages
than the Fortran school of languages.

>: Mike Feldman
>
>--
>-Matt Kennel  		mbk@inls1.ucsd.edu
>-Institute for Nonlinear Science, University of California, San Diego
>-*** AD: Archive for nonlinear dynamics papers & programs: FTP to
>-***     lyapunov.ucsd.edu, username "anonymous".

-Tucker Taft  stt@inmet.com
Intermetrics, Inc.
Cambridge, MA  02138



  reply	other threads:[~1994-11-02  6:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-10-31 15:33 Interfaces.Ada Kyongsuk Pace
1994-11-01 18:06 ` Interfaces.Ada Michael Feldman
1994-11-01 21:04   ` Interfaces.Ada Matt Kennel
1994-11-02  6:24     ` Tucker Taft [this message]
1994-11-02 13:55     ` Interfaces.Ada Mats Weber
1994-11-02 16:14     ` Interfaces.Ada Stephen J Bevan
1994-11-03 11:18     ` Interfaces.Ada Robert Dewar
1994-11-05  3:14       ` Interfaces.Ada Michael Feldman
1994-11-03 11:15   ` Interfaces.Ada Robert Dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox