FORTRAN compiler warning: obsolete arithmetic IF statement

醉酒当歌 提交于 2019-12-02 11:44:26

Arithmetic if is a peculiar feature of FORTRAN

it works as follows.

 IF (expr) label1, label2, label3

If the value of the expression is

less than 0, jump to label1 
equal to 0, jump to label2
greater than 0, jump to label3

In newer FORTRAN standards this feature is obsolete

In your code you can replace it with

      IF (s12 - 1.0 .gt. 0 ) GOTO 12
13    z = s1 / s12

Check here:

http://www.ibiblio.org/pub/languages/fortran/ch1-5.html

"The Arithmetic IF is considered harmful."

Your statement,

if (s12 - 1.0) 13, 13, 12 is an Arithmetic IF, and is considered bad programming.

Quoth Wikipedia:

"..the Fortran statement defines three different branches depending on whether the result of an expression was negative, zero, or positive, in said order..."

"..was finally labeled obsolescent in Fortran 90."

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!