Re: Huge program, no interfaces, ugh
- From: Gordon Sande <g.sande@xxxxxxxxxxxxxxxx>
- Date: Wed, 31 Jan 2007 17:50:42 GMT
On 2007-01-31 13:01:36 -0400, "Ancient_Hacker" <grg2@xxxxxxxxxxx> said:
HI, I have this relatively huge program, about 40,000 lines in 183
source files.
I've found lots of errors in the source code caused by arguments that
don't match the subroutine dummy argument type.
But the compiler doesnt find many of these by itself, as none of the
subroutines had interfaces (to start out with). I'm building up
interfaces as I go along, but the task is error-prone-- if I forget to
add "use glue" to a subroutine, it will silently compile anyway and
generate bad calls.
It sure would be nice if the compiler required interfaces for every
called function or subroutine.
Is there some Fortran option to require these?
Thanks,
grg
A way to get there with a small amount of work is to make everything
into CONTAINed units. You end up with
program all_of_it
implicit none
call old_main
contains
subroutine old_main ! which used to be program main
...
end subroutine ! use a text editor to turn END into END SUBROUTINE
subroutine xxx
...
end subroutine ! use a text editor to turn END into END SUBROUTINE
function yyy
...
end function ! use a text editor to turn END into END FUNCTION
end
and note a couple gotchas
1. external units don't work as you can not pass the
internal units as arguements
2. external statments need to be taken out
as they force things to not be internal.
To bad as an otherwise good style bites.
3. no declarations at all before the CONTAINs to
keep from accidental host associations for undeclared variables.
But then you have implicit none everywhere don't you!
All this may solve your problems if you do not have the gotchas. They
can be worked around. You will need lots of include statements and fixing
all the ENDs is a bother. But you have to choose what is the least fuss
to get the F90 checking. Do it on a copy etc, etc.
When you are done it will be time to make up various modules of groups
of your units.
.
- References:
- Huge program, no interfaces, ugh
- From: Ancient_Hacker
- Huge program, no interfaces, ugh
- Prev by Date: Re: Huge program, no interfaces, ugh
- Next by Date: Re: CDC Floating point = tests?
- Previous by thread: Re: Huge program, no interfaces, ugh
- Next by thread: Re: Huge program, no interfaces, ugh
- Index(es):
Relevant Pages
|