Fortran中的可变长度参数列表? [英] Variable length argument list in Fortran?
问题描述
Fortran 有没有像 C 那样处理任意长度的子程序参数列表?(顺便说一句,礼物"不适用于我正在尝试做的事情.)谢谢.
Has Fortran ever gotten around to handling subroutine argument lists with arbitrary length, like C can do? (BTW, "present" isn't going to work for what I am trying to do.) Thanks.
推荐答案
Fortran 中没有这样的子程序.
There are no such subroutines in Fortran.
Fortran 2008 中子程序语句的语法规则是 (12.6.2.3, R1235):
The syntax rule for a subroutine statement in Fortran 2008 is (12.6.2.3, R1235):
[ prefix ] 子程序子程序名称 [ ( [ dummy-arg-list ] ) [ proc-language-binding-spec ] ]
[ prefix ] SUBROUTINE subroutine-name [ ( [ dummy-arg-list ] ) [ proc-language-binding-spec ] ]
其中 dummy-arg-list
是 dummy-arg
的 list(在假定的语法规则术语中).dummy-arg
是 (R1235) name 或文字 *
.
where dummy-arg-list
is a list (in assumed syntax rule terms) of dummy-arg
s. A dummy-arg
is (R1235) either a name or a literal *
.
[在我们对可变参数支持的可能性感到过于兴奋之前,*
当然是指一个替代返回指示器.]
[Before we get too excited about the possibility of variadic support, the *
refers, of course, to an alternate return indicator.]
列表 (R101) 仍然是指(在源时间)明确定义的项目数量.
A list (R101) still refers to a well-defined (at source time) number of items.
关于与 C 的互操作性有一个明确的限制,即 (15.3.7) C 原型
There is a stated restriction regarding interoperability with C, that (15.3.7) the C prototype
... 没有由省略号 (...) 表示的可变参数
... does not have variable arguments as denoted by the ellipsis (...)
类似的参数适用于 (Fortran) 函数.
Similar arguments apply to (Fortran) functions.
这篇关于Fortran中的可变长度参数列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!