Re: generic interface real function vs real



Have you tried overloading (on arg type) ?

Skip Knoble

On Wed, 16 Apr 2008 15:13:54 -0700 (PDT), mabrowning <mabrowningrr@xxxxxxxxx> wrote:

-|I am trying to create a subroutine that can either take a time
-|dependent function, or a constant.
-|
-|It compiles and runs perfectly with GNU Fortran (GCC) 4.2.3, but ifort
-|(IFORT) 10.0 20070426 complains:
-|
-|fortcom: Warning: generic.f90, line 13: The type/rank/keyword
-|signature for this specific procedure matches another specific
-|procedure that shares the same generic-name. [FOO_SCALAR]
-| SUBROUTINE foo_scalar(A)
-|-------------------^
-|
-|It looks like the function signature and the scalar signature are the
-|same? This doesn't seem to make sense!
-|
-|---------------------------------------------------------------------------
-|example:
-|
-|MODULE foo
-| INTERFACE generic
-| MODULE PROCEDURE foo_fun, foo_scalar
-| END INTERFACE
-|CONTAINS
-| SUBROUTINE foo_fun(f)
-| INTERFACE
-| REAL FUNCTION f(t)
-| REAL t
-| END FUNCTION
-| END INTERFACE
-| WRITE(*,*)f(1.0)
-| END SUBROUTINE
-| SUBROUTINE foo_scalar(A)
-| REAL A
-| WRITE(*,*)A
-| END SUBROUTINE
-|END MODULE
-|
-|PROGRAM main
-|USE foo
-|REAL ::A=1.0
-|REAL, EXTERNAL :: f
-|CALL generic(A)
-|CALL generic(f)
-|END PROGRAM
-|
-|REAL FUNCTION f(t)
-| REAL t
-| f=t
-|END FUNCTION

.



Relevant Pages

  • Re: generic INTERFACE and name clash
    ... I would define the generic interface name and all of the specifics in one module. ... Unfortunately, the name FOO does not give me the foggiest ideas of what the subroutine does, so I cannot think of a more descriptive subroutine name. ... Module Procedure Foo_I2 ...
    (comp.lang.fortran)
  • Re: Fortran arguments by reference
    ... I tried mightily to store a procedure pointer in an integer, and was only able to do so by passing it to a C function. ... subroutine one ... integer:: param, foo ...
    (comp.lang.fortran)
  • Re: subroutines as arguments
    ... within foo if foo is RECURSIVE, but not for an external, non-RECURSIVE ... subroutine x ... without declaring y as EXTERNAL in subroutine x. ... interface to foo explicit within subroutine foo will give it the ...
    (comp.lang.fortran)
  • Re: generic INTERFACE and name clash
    ... If a subroutine, ... -|KIND number or else suffixes of RSP for Single Precision, ... the name FOO does not give me the ... -| Module Procedure Foo_I2 ...
    (comp.lang.fortran)
  • How to get "subroutine call depth watermark"?
    ... Is there a way for me to determine the "subroutine call depth ... A second best would be a similar watermark for the size of the perl ... DBsub foo{foo} ...
    (comp.lang.perl.misc)