Re: Does F90 do type checking when calling module subroutines?
- From: Ken Fairfield <my.full.name@xxxxxxxxx>
- Date: Mon, 25 Apr 2005 14:36:44 -0700
Neilen Marais wrote:
Hi
I was under the impression that if you call subroutines from modules, f90 would check the call paramter types? I'm using Intel fortran under linux. I have a subroutine defined in a module like this:
MODULE parseinput . . . INTERFACE read_namelists MODULE PROCEDURE read_namelists END INTERFACE . . . CONTAINS
SUBROUTINE read_namelists(infile) IMPLICIT NONE INTEGER(I4B), INTENT(in) :: infile
In another .f90 file, I included this subroutine with a USE parseinput statement. [...]
In addition to what Richard Maine said, I have some uneasiness about the last sentence quoted above. If you know all this, pardon my saying the obvious, but just to eliminate all sources of error...
F90 does not have a concept of "source file" as does C/C++. It is important that the "USE parseinput" statement be present in *every* subroutine or function, or the main program, that calls read_namelists. Secondly, the USE statement does *not* include the subroutine read_namelists. What it does is make any module parameters or variables visible to the compiler, and the _interfaces_ for any module procedures defined in the module. That's a lot different than, e.g., _including_ the source code for the subroutine.
-Ken -- I don't speak for Intel, Intel doesn't speak for me...
Ken Fairfield D1C Automation VMS System Support who: kenneth dot h dot fairfield where: intel dot com .
- Follow-Ups:
- Re: Does F90 do type checking when calling module subroutines?
- From: Richard E Maine
- Re: Does F90 do type checking when calling module subroutines?
- References:
- Does F90 do type checking when calling module subroutines?
- From: Neilen Marais
- Does F90 do type checking when calling module subroutines?
- Prev by Date: Re: Does F90 do type checking when calling module subroutines?
- Next by Date: Re: Representing structures for simulations
- Previous by thread: Re: Does F90 do type checking when calling module subroutines?
- Next by thread: Re: Does F90 do type checking when calling module subroutines?
- Index(es):
Relevant Pages
|