Re: why doesn't this compile ?
- From: Ken Fairfield <my.full.name@xxxxxxxxx>
- Date: Thu, 28 Apr 2005 10:49:12 -0700
Richard E Maine wrote: [...]
Up though f95, there are 2 options for specifying a specific procedure in a generic interface block. You either have an interface body or use a module procedure statement. If you have a procedure whose interface is already explicit, but which is not a module procedure, then this is awkward.
Before I read this response, but after rereading the "compilation problem" thread, I modified the OP's original code (single program, no module) to drop the interface bodies from the interface for "f" and and replace them by what you'd have if these were in a module:
----------------- program test_array_arguments
implicit none
! This interface allows us to pass both rank 1 and rank 2 arrays to the
! function f.
interface f
module procedure f_1, f_2 ! <<<==========
end interface finteger, dimension(2,3) :: x [...] ---------------------
Even though "module procedure" didn't make intuitive sense outside a module(!) that was all I could think to do.
Again on Alpha/VMS 7.3-1 with HP Fortran V7.6-3276-48D52, compiling with,
f90/stand=f95 TEST_ARRAY_ARGUMENTS2
was successful with no errors, and the program produced the same results as the "modulized" version now on the OP's web site. (Compiling with /standard=f90 produced this error:
----------------------
end interface f
.................^
%F90-W-WARNING, A generic-spec included on an end-interface-stmt is not standard
Fortran 90. [F]
at line number 12 in file TEST_ARRAY_ARGUMENTS2.F90;1
----------------------
But simply removing the "f" at the end of "end interface" allowed successful compilation and produced the same outout...)
My question whether the VMS Fortran compiler support of "module procedure" in the main program is a compiler *extension*, or is this standard-conforming F95? What about F2003??
In f2003, this is solved by dropping the keyword "module" from the module procedure statement. The restriction to module procedures was silly in the first place; the only thing important was that an explicit interface be accessible. Of course, the keyword "module" is still allowed for compatibility with existing code (and in that case, it is restricted to being a module procedure just because it is strange to have a "module procedure" statement refer to something that isn't). But there will probably be little reason for using the "module" keyword in new f2003 code except for issues of compatibility with f90/f95 compilers; it doesn't add any useful functionality.
Which begs the question: how *would* you define an generic interface to program-contained procedures under F95? I'd like to see an example of the awkwardness, both for education and for entertainment. :-) :-)
-Ken -- I don't speak for Intel, Intel doesn't speak for me...
Ken Fairfield D1C Automation VMS System Support who: kenneth dot h dot fairfield where: intel dot com .
- Follow-Ups:
- Re: why doesn't this compile ?
- From: Richard E Maine
- Re: why doesn't this compile ?
- References:
- why doesn't this compile ?
- From: Bart Vandewoestyne
- Re: why doesn't this compile ?
- From: Richard E Maine
- Re: why doesn't this compile ?
- From: beliavsky
- Re: why doesn't this compile ?
- From: Richard Maine
- Re: why doesn't this compile ?
- From: Bart Vandewoestyne
- Re: why doesn't this compile ?
- From: Richard E Maine
- why doesn't this compile ?
- Prev by Date: Re: Defining new operators
- Next by Date: Re: why doesn't this compile ?
- Previous by thread: Re: why doesn't this compile ?
- Next by thread: Re: why doesn't this compile ?
- Index(es):
Relevant Pages
|