At 12:12 PM 2/1/00 +1100, David Singleton wrote:
>Robert Ferrell wrote:
>> FORTRAN always passes by reference. So you need to declare
>>
>> void testfortran(double *);
>>
>> and pass arguments accordingly.
>
>
>As others will probably point out, this is not strictly true. Most
>Fortran systems do this but copy-in-copy-out pass-by-value is
>allowed. Indeed, Fujitsu compilers allow you to use this as an option.
Does the Fujitsu compiler actually implement copy-in/copy-out using
pass-by-value? All the copy-in/copy-out implementations with which I have
had experience still received a reference to the argument; they simply used
that reference to do a single copy-in and a single copy-out inside the
procedure rather than using the reference (address) each time the value of
the argument is accessed or changed. Part of the point of still receiving
a reference was to make it unnecessary for the caller of the procedure to
know whether the procedure directly references arguments or does
copy-in/copy-out.
I also know of compilers that supported language extensions that allowed
one to pass an argument by value, but that really was a feature for
supporting inter-language communication rather than an alternative
implementation of Fortran-to-Fortran communication.
--
Kurt W. Hirchert [log in to unmask]
Center for Computational Sciences +606-257-8748
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|