0

在子程序中,我想知道发生错误时哪个上层子程序正在调用它。有没有不使用参数的方法?因此子程序的用户可以被通知上层子程序。

4

1 回答 1

2

There is nothing built in to Fortran which will give you the sort of information you seek. You could, as you suggest, write your own programs to report the information but it strikes me that doing so might burden your code with a lot of error-reporting infrastructure which obscures its meaning and materially affects its importance.

I suggest that you investigate your compiler's capabilities. Intel Fortran, for example, offers a traceback option which is often useful for diagnosing the causes of problems. Start your reading here. All the other Fortran compilers I've worked with offer similar facilities, check the documentation.

于 2013-03-16T09:25:05.893 回答