optional arguments in subroutine or using generic procedure



Hi,

I want to write a subroutine with flexible numbers of arguments. One
of the argument 'ID' will decide how many arguments this subroutine
would have. If ID=1, fewer arguments. If ID=2, add many additional
arguments. I am pondering if I have to write two subroutines with
different names and using generic procedure, or I write only one
subroutine with optional arguments declared. Currently, I've chosen
using generic procedure. However, it doesn't seem beneficially enough,
but only with length interface and a generic name only. So why use
generic procedure?
thank you.

Mike.

.



Relevant Pages

  • Re: optional arguments in subroutine or using generic procedure
    ... I want to write a subroutine with flexible numbers of arguments. ... different names and using generic procedure, ... more components to the structure) without changing the interface. ... I only have to check one derived type by using ...
    (comp.lang.fortran)
  • Re: optional arguments in subroutine or using generic procedure
    ... Mike wrote: ... I want to write a subroutine with flexible numbers of arguments. ... different names and using generic procedure, ... It will also allow you to alter the number of additional optional arguments without changing the interface. ...
    (comp.lang.fortran)
  • Re: compiler switch -c
    ... All methods must be exposed by interface. ... module procedure fruit_summary_ ... end subroutine init_fruit_ ... character, intent, optional:: message ...
    (comp.lang.fortran)
  • TRANSFER arbitrary data ? (long)
    ... subroutine to minimize a function of n variables, ... end interface ... that to an integer array and back. ... subroutine minimize(Func, x, context) ...
    (comp.lang.fortran)
  • Re: Are procedure dummy arguments ignored in generic procedure resolution?
    ... the interface block that defines the ... recursive subroutine step_up ... Compiling program unit mykinds at line 1: ...
    (comp.lang.fortran)