assumed shape dummy arrays and implicit interfaces
Richard E Maine
Richard.Maine@nasa.gov
Wed Sep 14 14:57:00 GMT 2005
On Sep 13, 2005, at 11:52 PM, THOMAS Paul Richard 169137 wrote:
> Why do we not always pass array descriptors? Come to that, why do we
> not
> store arrays as structures, rather than recreating descriptors all the
> time?
I'm not sure what you mean by the question about structures, so I'll
ignore it. As for why you don't always pass array descriptors, well...
I can't testify as to why gfortran doesn't. I'm almost sure you could
make such an implementation work and conform to the standard. But I
know why the standard went to a lot of trouble... make than an *AWFUL
LOT* of trouble to distinguish cases where you need to pass descriptors
from those where you don't need to. Of course, the standard doesn't use
that kind of implementation terminology, but the implications are
there.
The standard doesn't *REQUIRE* an f95 compiler to be compatible with
libraries compiled by f77, C, or anything other than itself. And your
users wouldn't even bitch much if you didn't have such
compatibility.... but that's only because you wouldn't have enough
users to bitch much. :-)
Since f77 compilers (with rare exceptions) didn't pass array
descriptors, you had better not pass one when calling a routine that
might have been compiled by an f77 compiler. An awful lot of the
complication in distinguishing between what does and doesn't require an
explicit interface has to do with compatibility with f77 (and somewhat
with C, as a side effect, but f77 was the objective) compilers. You
don't think that it would have been such a "mess" if it were designed
from scratch without compatibility needs, do you? I don't. Anything
that could possibly have been written in f77 has to work with an
implicit interface (since that's all f77 had) and has to not pass
descriptors because f77 compilers (mostly) didn't. This has to work in
both directions - an f90/f95/f2003 call to an f77 routine, or an
f90/f95/f2003 routine being called from f77. But some new features need
descriptors or something similar in order to work reasonably. The
explicit interface lets you know whether you need the descriptor for
new features or need to not have one for f77 compatibility.
--
Richard Maine | Good judgment comes from experience;
Richard.Maine@nasa.gov | experience comes from bad judgment.
| -- Mark Twain
More information about the Fortran
mailing list