Re: procedure argument
- From: nospam@xxxxxxxxxxxxx (Richard E Maine)
- Date: Thu, 30 Mar 2006 11:52:45 -0800
Roland Schmehl <rschmehl@xxxxxxxxx> wrote:
[invalid code]
why does it accept the EXTERNAL statements?
Because compilers are not required to diagnose all errors, specifically
including this one. The code is invalid, but that doesn't mean the
compiler will necessarily figure that out. Some compilers might diagnose
the error. Others might crash when trying to run it. Others might appear
to "work" for some definition of the term, which is what you observed.
This is the nature of invalid (well... nonstandard) code.
Implicit interfaces (which you have with the EXTERNAL statement) are
notorious for being prone to errors that are typically not detected by
compilers. This was a major source of program crashes in pre-f90 codes.
I advise using explicit interfaces in new code whenever practical (note
that having an explicit interface does not necessarily mean writing out
an interface body; module procedures and internal procedures always have
explicit interfaces). If you use implicit interfaces, you will have
increased odds of such undiagnosed errors. There are also other reasons
to use explicit interfaces, but I'll not go into that right now.
As to why a particular compiler does or does not disgnose the problem -
that's a question for the compiler writers. The answer will presumably
vary from one compiler to another. I can predict that the general gist
of the answer, for those compilers that don't diagnose it, is probably
along the general line of too much work for the benefit. A compiler does
generally have to go to a lot more work if it is to cross-check such
things when implicit interfaces are used.
--
Richard Maine | Good judgment comes from experience;
email: my first.last at org.domain| experience comes from bad judgment.
org: nasa, domain: gov | -- Mark Twain
.
- References:
- procedure argument
- From: Roland Schmehl
- procedure argument
- Prev by Date: Re: Help: IFC stack overflow
- Next by Date: Re: Help: IFC stack overflow
- Previous by thread: Re: procedure argument
- Next by thread: Help: IFC stack overflow
- Index(es):
Relevant Pages
|