On 05/31/2012 10:27 AM, Phillip Helbig---undress to reply wrote:
> I've never had occasion to use this until now, and don't recall seeing
> any examples. My guess is that a procedure dummy argument can be
> optional just like any other. How would this be declared? A
> hand-written INTERFACE block (I think this is the only time one needs to
> write an INTERFACE block by hand; of course this is not necessary if the
> routine is in a module which is used, but for library-type routines with
> optional procedure arguments this can't be done) and an additional,
> separate OPTIONAL statement?
>
No problem in F2003, consider this:
module foo
abstract interface
integer function fi ()
end function fi
end interface
contains
subroutine apply_f (f)
procedure (fi), optional :: f
if (present (f)) print *, f ()
end subroutine apply_f
end module foo
-- Wolfgang
--
E-mail:
firstnameinitial.lastname@domain.de
Domain:
yahoo