(j3.2006) should it make a difference if the interface is explicit or implicit?

Bill Long longb at cray.com
Sun May 24 12:07:17 EDT 2009


If the dummy argument has an implicit interface, then the corresponding 
actual may have an implicit interface (essential for legacy codes) or an 
explicit interface.  A programmer should be allowed to specify an 
explicit interface  (which could be useful for reasons unrelated to the 
call in question) for the actual argument  procedure and still be able 
to pass that procedure to legacy library codes that have dummies with 
implicit interfaces.  You don't want to break existing, conforming code 
because you added an explicit interface. 

If the dummy argument has an explicit interface, then the corresponding 
actual needs to have an interface for which a specified set of 
characteristics match.   That's because the  uses of the  dummy can 
assume these characteristics are valid for the actual.  However, I don't 
see where the standard actually requires that the interface in the 
caller for the actual argument has to be explicit (unless it's required 
for other reasons, such as having optional arguments).  The required 
characteristics can match without spelling them out in an explicit 
interface.   Having the explicit interface in the caller does not do the 
called procedure any good - it goes by the interface specified for the 
corresponding dummy. Unless the compiler does global interface checking, 
there is no cross-checking benefit to the user.    So I don't see any 
motivation to require an explicit interface for the actual just because 
the dummy has one. It is just required that the programmer meet the 
requirements of matching characteristics.

Cheers,
Bill



Robert Corbett wrote:
> Suppose a routine that can have implicit interface is passed as an
> actual argument that becomes associated with a dummy procedure.  If
> the dummy procedure has explicit interface, is the actual argument
> required to have explicit interface?  If the dummy procedure has
> implicit interface, is the actual argument required to have implicit
> interface?
>
> My reading of Section 12.4.1.3 of the Fortran 2003 standard is that
> if the dummy procedure has explicit interface, then the actual
> argument must have explicit interface, but if the dummy procedure
> has implicit interface, the actual argument can have either implicit
> or explicit interface.  Is that the intended semantics?
>
> Bob Corbett
> _______________________________________________
> J3 mailing list
> J3 at j3-fortran.org
> http://j3-fortran.org/mailman/listinfo/j3
>   

-- 
Bill Long                                   longb at cray.com
Fortran Technical Support    &              voice: 651-605-9024
Bioinformatics Software Development         fax:   651-605-9142
Cray Inc., 1340 Mendota Heights Rd., Mendota Heights, MN, 55120

            



More information about the J3 mailing list