且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Fortran本身的界面会产生令人讨厌的错误

更新时间:2023-11-10 10:20:22

此行为由Fortran标准指定.标准委员会讨论了放宽所谓自我接口"的限制,但最终拒绝了.我不记得具体情况.由于该标准禁止使用它,因此要求编译器能够对其进行诊断,并且大多数默认情况下都可以执行.

This behavior is specified by the Fortran standard. The standards committee discussed relaxing the restriction, termed "interface to self", but ultimately rejected it. I don't remember the specifics. Since the standard forbids it, compilers are required to be able to diagnose it and most do by default.

仅当尝试逐步更新F77样式的程序以使用显式接口时,您才会遇到此问题.我会注意到,英特尔Fortran(也许还有gfortran)具有一项功能会自动为您检查此类接口(在ifort中是-warn接口).

You'd encounter this problem only when trying to incrementally update an F77-style program to use explicit interfaces. I'll note that Intel Fortran, and maybe gfortran as well, has a feature that will automatically check such interfaces for you (in ifort it's -warn interface).

也许更好的方法是将您的过程放在模块中.

Perhaps the better approach is to put your procedures in modules.