Function 具有可选参数的Fortran函数

Function 具有可选参数的Fortran函数,function,fortran,optional,Function,Fortran,Optional,我想使用运算符.ef.,但是该运算符不接受可选参数。是否可以保持my功能,并使操作员也能工作 Module Core Implicit None Interface Operator (.ef.) Module Procedure fes End Interface Operator (.ef.) Contains Function fes & ( & nm, wn & ) &

我想使用运算符
.ef.
,但是该运算符不接受可选参数。是否可以保持my功能,并使操作员也能工作

Module Core
Implicit None

Interface Operator (.ef.)
  Module Procedure fes
End Interface Operator (.ef.)

Contains

Function fes    &
  (             &
    nm, wn      &
  )             &
    Result (located)

Logical :: located
Character (Len=*), Intent (In) :: nm
Character (Len=*), Intent (In), Optional :: wn 

End Function 
Gfortran返回以下问题

lib/scriptus/core.f:62:0:

Function fes    &
1
Error: Second argument of operator interface at (1) cannot be optional

不允许对定义的操作使用可选参数。Fortran 2008,第12.4.3.4.2条。说:

1。。。伪参数应为非可选的伪数据对象

这是编译器发出错误时引用的内容:

错误:(1)处运算符接口的第二个参数不能是可选的


注意:您可以有带有可选参数的过程,它们可以出现在模块中,但不能在带有
运算符的接口块中引用它们。您的函数
fes
看起来不错,这不是问题所在。您的问题是将运算符映射到函数的接口块。

@Zeus与其在此问题上添加第二个问题,不如将其作为新问题提问。