Re: How can I simply use (old) routines?
- From: nospam@xxxxxxxxxxxxx (Richard Maine)
- Date: Mon, 18 Sep 2006 08:58:28 -0700
Arno <arnoinperu@xxxxxxxxxxx> wrote:
But the compiler does know what the return value of the function is, as
the function is said to be an integer function:
integer function set_number(i)
So, why do I have to specify that again in main.f90?
No the compiler does not know that *WHEN COMPILING THE MAIN PROGRAM". It
is fundamental to the design external procedures that they can be
compiled separately. Your function could, in principle, be in a separate
file - one that you haven't even written yet when compiling the main
program. So the compiler doesn't get to "look" at the function when
compiling the main. The standard is written from that viewpoint.
Internal and modul functions, introduced in f90, are different. In those
cases, the compiler does know about the function when compiling the
main. If you think that is a better way for things to be, I agree; I
recommend using module or internal procedures instead of external ones
in most cases. But external procedures were the only option before f90,
so if you have old code and don't want to change it, then you have to
play by the rules for external procedures.
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain