Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Function 功能歧义_Function_Fortran_Ambiguous Call - Fatal编程技术网

Function 功能歧义

Function 功能歧义,function,fortran,ambiguous-call,Function,Fortran,Ambiguous Call,我无法理解这两个函数是如何产生歧义的。 如果类型更改为integer或real,编译器不会 标记任何歧义 Function split_to_str_unidim & ( & a, delim, mold, & pos & ) & Result (bn)

我无法理解这两个函数是如何产生歧义的。 如果类型更改为integer或real,编译器不会 标记任何歧义

Function split_to_str_unidim  &
  (                           &
    a, delim, mold,           &
    pos                       &
  )                           &
    Result (bn)

  Character (len=*), Intent (in) :: a, delim, mold
  Character (len=*), Intent (in), Optional :: pos

  Character (len=65), Allocatable :: bn(:)

End Function


Function split_to_str        &
  (                          &
    a, delim, b1, b2,        &
    b3, b4, b5, b6, b7, b8,  & 
    pos                      &
  )                          &
    Result (b)

  Character (len=*), Intent (in) :: a, delim
  Character (len=*), Intent (in), Optional :: pos

  Character (len=*), Intent (out) :: b1, b2
  Character (len=*), Intent (out), Optional :: b3, b4, b5, b6, b7, b8
  Logical :: b

End Function
电话,如

split_to_str(a,b,c,d)
其中
a、b、c、d都是字符串,不能用两个函数中的一个明确地识别它们。这是模棱两可的

为了消除歧义,您必须使签名(非可选的,intent(in)参数列表)唯一。从你最近的Qs记录来看,正如你已经和其他人讨论过的,我没有什么要补充的


我很惊讶将类型从
character(len=*)
更改为
real
integer
不会有同样的问题。

有什么建议可以解决这个矛盾吗?不要将这两个函数放在一个接口中(我假设您已经这样做了)。只需根据上下文调用相应的。