Re: Fortran 2003: abstract interfaces



On 31 jan, 15:52, Tobias Burnus <bur...@xxxxxxxx> wrote:
On Jan 31, 2:54 pm, Arjen Markus <arjen.mar...@xxxxxxxxxx> wrote:

abstract interface
   subroutine dothis( ... )
   end subroutine
end interface
This abstract interface is part of a typ definition.

How do I specify that a particular routine implements the interface
"dothis"?
Is that via the procedure statement:
   procedure(dothis) :: do_it_this_way

This works.

Or via:
   interface dothis
       module procedure do_it_this_way
   end interface
Or how?

This does not work since (a) do_it_this_way is not a module procedure
and "interface dothis" clashes with "subroutine dothis" in the
abstract interface.

By the way: NAG f95, gfortran and g95 correctly accept the first
version and reject the second version. Thus to find out whether (a) or
(b) is valid, one can simply try it out and see what a compiler
accepts or rejects. If several compilers behave identically (which
support a given feature), it is a good indication that their
diagnostic is right.

Tobias

Okay, thanks - I thought the first solution would be the
true one, just did not know of a compiler sufficiently aware
of Fortran 2003 to check it. The first one makes most
sense (if I understand it correctly).

Regards,

Arjen
.



Relevant Pages