Re: What's the purpose of explicit interfaces? (Pun intended?)



Michael Metcalf wrote:
"Joe Krahn" <jkrahn@xxxxxxxxx> wrote in message news:yMXSf.39900$915.37925@xxxxxxxxxxxxxxxxxxx
An explicit interface seems useful, but it makes sense to put it in an include file and allow the described routines to include the definitions to verify them, as in C. It seems that the usual idea is to use modules instead of definition headers. So, what is the use of writing out an explicit interface? If it is sometimes useful, why not allow the described routine to include and validate the accuracy of that definition?

Usually, an explicit interface is defined by placing the procedure in question within a module or using it as an internal procedure. No further work is necessary. The only time that it should be spelled out is when it defines the interface of a procedure argument (MR&C, Section 5.12), or when dealing with external procedures from legacy Fortran 77. Even there, an eternal statement would suffice but allows no checks to be made.
^^^^^^^

Now _there_ is a new statement that could be considered for inclusion in the next revision of Fortran 2xxx ! The declaration

ETERNAL <subname> (<arguments)

would put the compiler on notice that it should compile the code that follows in such a way that subsequent linking to `eternal' (= F77 ? F64 ? F II ?) legacy code should work correctly; this would be somewhat analogous to the C++ declaration

extern "C" {...}


Regards,

MikecMetcalf



N. Shamsundar
University of Houston
.



Relevant Pages

  • managing header files
    ... while in the .h files the external declarations showed no arguments. ... Apparently that was the reason the compiler wasn't catching errors of the ... wrong number of arguments when routines were called from other files. ... Then I went through the all the header files ...
    (comp.lang.c.moderated)
  • Re: Sunperf library, pure functions?
    ... F95 compilers often were typically evolutionary ... > As such, if compiler internals included f90 in their names, these ... generic interface. ... question is a member of the 'family' of routines designated as ...
    (comp.lang.fortran)
  • Re: Overrides and mybase ??
    ... Yes this is known as overloading. ... Yes the compiler looks at the number of parameters & their types to decide ... The signatures of the methods (routines) need to be unique on number & type ... |>> calling the base classes default constructor. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Query:api problems!
    ... API is usually an abbreviation for "Application Programmer Interface". ... For any packaged routines, the program's API is the official documented ... You may need to tell the compiler where to find the include files ... the package into your executable. ...
    (comp.lang.c)
  • Re: Halt execution procedure
    ... the module was compiled with the NAG compiler. ... The Slatec routines themselves are F77 ... and the module wrappers don't have to conform to F ...
    (comp.lang.fortran)