On Wed, 2 Feb 2000, David C. P. LaFrance-Linden wrote:
> If your FORTRAN compiler is pass-by-reference, at least do it that way
> from C++. Instead of
> void testfortran(double *);
> as some have suggested, do
> void testfortran(double &); <=================== (*)
> It will even make your code easier to write, read and maintain since
> you won't have to worry about pointers all the time. You will have to
> remember that the arguments may get updated, but you have to do that
> with any C++ reference argument. For INTENT(IN) parameters, you can
> probably even declare it
> void testfortran(const double &);
>
> (As a coworker pointed out to me, Fortran (often) passes values by
> reference; C++ passes references by value.)
C does only call by value, but C++ does both call by value and call by
reference as you indicated in (*).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|