Generics Fortran运算符

Generics Fortran运算符,generics,fortran,operator-keyword,Generics,Fortran,Operator Keyword,但是,我使用^实现了两个向量的叉积 我收到一个错误。不知道如何解决这个问题 这是密码 Interface Operator (^) Module Procedure vector_cross_product End Interface Operator (^) Contains Function vector_cross_product (u, v) Result (w) !!$ Input Type (Vector), Intent(in) :: u, v

但是,我使用^实现了两个向量的叉积 我收到一个错误。不知道如何解决这个问题

这是密码

Interface Operator (^)
    Module Procedure vector_cross_product
End Interface Operator (^)

Contains

Function vector_cross_product (u, v) Result (w)

    !!$ Input
    Type (Vector), Intent(in) :: u, v

    !!$ Output
    Type (Vector) :: w

    w% x = (u% y * v% z) - (u% z * v% y)
    w% y = (u% z * v% x) - (u% x * v% z)
    w% z = (u% x * v% y) - (u% y * v% x)

End Function vector_cross_product
这是我在使用gfortran时遇到的相应错误

Interface Operator (^)
                    1
Error: Syntax error in generic specification at (1)
lib/vectors.f:110.18:

  Module Procedure vector_cross_product
                  1
Error: MODULE PROCEDURE at (1) must be in a generic module interface
lib/vectors.f:111.3:

End Interface Operator (^)
   1
Error: Expecting END MODULE statement at (1)

我相信该标准排除了在定义运算符时使用任意符号,例如
^
。在2008年标准草案中,我必须提交第7.1.6.1.4段

二进制定义的操作是形式为x1的操作 定义的二进制运算x2或x1内禀运算符x2和 通过函数和通用接口


定义的二进制op是站之间的字母序列,例如
.cross.
.times.
,而内在运算符是语言标准中定义的运算符之一(
+
。[该序列由7.1.2.8中的R723定义。]这些限制是有原因的。它们不会随着Fortran 2015而消失,我也看不到它们会在固定源代码形式之前消失。