Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
fortran goto示波器_Fortran_Goto - Fatal编程技术网

fortran goto示波器

fortran goto示波器,fortran,goto,Fortran,Goto,我有一个遗留的fortran代码,其中包含许多语句,如“goto 50”。我想知道goto的目标是全球还是本地。我的意思是,如果多个函数有一个目标'50',goto将指向何处 谢谢回答。本地 技术上符合f77标准() “语句标签有一个程序单元的作用域。”语句标签(例如,“50”)必须在当前的“作用域单元”中定义,在这种情况下,它基本上转换为goto调用所在的子例程/函数(或主程序,如果调用在主程序中) 例如,在下面的程序中,主程序和包含的两个子例程都有自己的标签50,GOTO转到“它们的”第50

我有一个遗留的fortran代码,其中包含许多语句,如“goto 50”。我想知道goto的目标是全球还是本地。我的意思是,如果多个函数有一个目标'50',goto将指向何处

谢谢回答。

本地

技术上符合f77标准()

“语句标签有一个程序单元的作用域。”

语句标签(例如,“50”)必须在当前的“作用域单元”中定义,在这种情况下,它基本上转换为goto调用所在的子例程/函数(或主程序,如果调用在主程序中)

例如,在下面的程序中,主程序和包含的两个子例程都有自己的标签50,GOTO转到“它们的”第50行

program testgotos
    implicit none

    goto 50
    call second
 50 call first
    call second

contains

    subroutine first
    integer :: a = 10

    goto 50
    a = 20
 50 print *,'First: a = ', a

    end subroutine first

    subroutine second
    integer :: a = 20

    goto 50
    a = 40
 50 print *,'Second: a = ', a

    end subroutine second

end program testgotos