A question regarding array-valued functions in fortran 90 
Author Message
 A question regarding array-valued functions in fortran 90



Quote:
>I was writing a fortran program with my own array-valued function. The only way
>that I could find to get the code to compile/link/run correctly was to include
>an explicit interface block for the array-valued function in the calling
>routine. Is there another way to do this?

The preferred way is to place the function definition in a module,
which makes the interface implicitly available in any program unit that
uses the module.

--

      ++++ stop the execution of Mumia Abu-Jamal ++++
    ++++ if you agree copy these lines to your sig ++++
++++ see http://www.*-*-*.com/ ~tank/spg-l/sigaction.htm ++++



Sat, 03 Jul 1999 03:00:00 GMT  
 A question regarding array-valued functions in fortran 90

There are several conditions that require explicit
interfaces. See Metcalf & Reid, Fortran 90/95 Explained,
chapter 5, or page 491 of Fortran 90 Handbook. Anyway,
array-valued functions are one of these cases.

One important way to get an explicit interface is with
an interface block in the caller, as Don Sinclair noted

The other way is to note that procedures that are
accessed by USE association automatically have an
explicit intreface, as pointed out by Karki Jitendra
Bahadur.

These are the only alternatives.

- Loren Meissner



Sat, 03 Jul 1999 03:00:00 GMT  
 A question regarding array-valued functions in fortran 90

Quote:

>I was writing a fortran program with my own array-valued function. The only way
>that I could find to get the code to compile/link/run correctly was to include
>an explicit interface block for the array-valued function in the calling
>routine. Is there another way to do this?
>                                               Don Sinclair.

In Fortran 90, one normally puts all the functions and subroutines in one or
more modules, and then USEs the module[s] in the calling program unit.  This
may seem like an annoying additional step coming from F77, but it's a good
habit to get into.  For the cost of 5 additional lines in your code
(module all_my_functions; implicit none; contains; end module all_my_functions;
use all_my_functions) you get automatic type checking and access to the new(?)
Fortran 90 advanced function features, just like you had an explicit interface
block for each program unit.  This is one thing Fortran seems to do better
than C++; in that language you really do need the equivalent of an explicit
interface block for each program unit, requiring that you maintain header
files to go with each source file.


Sat, 03 Jul 1999 03:00:00 GMT  
 A question regarding array-valued functions in fortran 90

I was writing a fortran program with my own array-valued function. The only way
that I could find to get the code to compile/link/run correctly was to include
an explicit interface block for the array-valued function in the calling
routine. Is there another way to do this?
                                               Don Sinclair.



Sun, 04 Jul 1999 22:43:00 GMT  
 A question regarding array-valued functions in fortran 90



...

Quote:
> These are the only alternatives.

...

Somebody pointed out that I forgot a third way to get an explicit
interface.

1. Interface block for the procedure in its caller

2. USE a module that defines the procedure in a module subprogram

3. Define an internal procedure within the caller

- Loren Meissner



Mon, 05 Jul 1999 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Fortran 90 intrinsic array function?

2. array storage question Fortran 90

3. Fortran 90/95 array questions

4. Question on allocatable arrays in Fortran 90

5. Allocatable arrays in Type definition (Fortran 90 question)

6. Call Array valued Fortran function from C

7. DEC Fortran 90 -> SGI Fortran 90

8. passing by value in Fortran 90

9. Allocatable Arrays in Fortran 90

10. Passing arrays to subroutines in fortran 90

11. Fortran 90 Arrays and C++

12. Fortran 90 and C dynamic arrays?

 

 
Powered by phpBB® Forum Software