I am working with a legacy Fortran 77 code subroutine where the parameter types are not declared at the top of the code block.
Here is a snippet showing the very top of the subroutine.
SUBROUTINE BPASS(F1,F2,F3,F4,SI,N,A,IERR)
REAL * 4 A( N ),FV( 4 )
From the above, I think that A
is an array of length N
with type REAL *4
, equivalent in size to a C float
. Alternately, FV(4)
is an array of length 4
with type REAL *4
.
However, what are the types of F1,F2,F3,F4,SI,N,IERR
, if the types are not listed? It appears that N
should be an integer
.
I need to know the types so that I can call the subroutine from C++ code. Is there a Fortran convention for the types that are not declared?
By default Fortran will assign the type integer
to variables whose names begin with the letters I,J,K,L,M,N
and type real
to all other undeclared variables.
I agree with your parsing of the definitions of A
and FV
.
Modern Fortran provides the expression implicit none
for ensuring that the default rules are not applied, but when working with old codes it's sometimes not possible to avoid familiarity with the old dark ways.