From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.4 required=3.0 tests=BAYES_00,SUBJ_ALL_CAPS autolearn=no autolearn_force=no version=3.4.5-pre1 Date: 10 Aug 93 14:00:38 GMT From: slinky.cs.nyu.edu!slinky.cs.nyu.edu!nobody@nyu.edu (Robert Dewar) Subject: Re: QUERY ABOUT MONITOR Message-ID: <2489m6$2ht@schonberg.cs.nyu.edu> List-Id: Mike repeats a common myth about Fortran, namely that it requires arrays to be passed by reference. This is rubbish. In fact Ada tried to copy Fortran's approach carefully. Both Ada and Fortran allow composite objects to be passed by reference or value, as decided by the compiler. Any Fortran code that counts on pass by reference is faulty (Mike if you don't believe this, settl down with the Fortran standard, it's perfectly clear there). However, in practice, both in Ada and Fortran, arrays are typically passed by reference, so this is from a pragmatic point of view a non-issue. All Ada compilers I know of lay out arrays contiguously (interestingly enough Mike makes the opposite mistake here, Fortran DOES require arrays to be laid out contiguously, it's not an obvious requirement, but it is a ramification of the rules for passing arrays in Fortran). So that also is not in practice a problem. Now what about passing descriptors etc. Well we obviously must have pragma Interface FORTRAN available in an Ada compiler to interface to Fortran. To try such an interface if the Ada compiler does not intend to allow it is of course hazardous at best, and unlikely to work. If pragma Interface FORTRAN is available, then of course any reasonable implementation of it will pass arrays in the Fortran manner (typically passing the address of the first element, or perhaps the virtual array origin if this is how the fortran compiler works). On the other hand you would neither expect nor want it to make a copy of the array into column-major form, so you would normally expect, in an Ada 83 context, to have to flip the subscripts on the Ada side, which is an annoyance but not a disaster (I certainly think it's a reasonable frill to add the relevant pragma in Ada 9X). The point here is that the mapping of arrays is not the fundamental issue in a Fortran binding. If Mike is working with a compiler that tries to pass array descriptors to a subprogram to which pragma Interface FORTRAN is applied, then that compiler is broken. If he is working with a compiler that has no pragma Interface FORTRAN at all, then clearly that is not the tool to interface Ada and Fortran! P.S. I keep forgetting, but the name FORTRAN has been officially changed to Fortran now, very confusing!