Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Self-referencing abstract interface - legal?

11 views
Skip to first unread message

Arjen Markus

unread,
Aug 24, 2010, 6:57:43 AM8/24/10
to
Hello,

I happened to make a mistake in defining a set of abstract interfaces
and one compiler
that I use chokes on it, whereas another accepts it without any fuss.
Looking more
closely I found the error - the interface "compute_routine" refers to
itself and I wanted
a different interface. However, I wonder if this is at all legal.

Here is the code in question (just the essential part):

module computation_data

implicit none

type computation_method
character(len=40) ::
name
procedure(compute_routine), pointer, nopass :: compute
end type

abstract interface
subroutine compute_routine( param_value, zfunc, probability )
real, dimension(:), intent(in) :: param_value
procedure(compute_routine) :: zfunc
real, intent(in) :: probability
end subroutine
end interface

end module computation_data


Regards,

Arjen

robert....@oracle.com

unread,
Aug 25, 2010, 3:36:15 AM8/25/10
to

The abstract interface shown is standard conforming. The name
compute_routine has not been declared before its use in the
PROCEDURE statement, but the Fortran standard does not require
it to be declared before such a use. If the name compute_routine
had itself been declared by a PROCEDURE statement, that
declaration would be required to appear before the use of the
name.

Bob Corbett

0 new messages