I have a legacy fortran code with many statements like 'goto 50'. I was wondering whether the target of goto is global or local. I mean, if multiple functions have a target '50', where does the goto leads to.
Thanks for answering.
I have a legacy fortran code with many statements like 'goto 50'. I was wondering whether the target of goto is global or local. I mean, if multiple functions have a target '50', where does the goto leads to.
Thanks for answering.
Local.
Technically from the f77 standard ( http://www.fortran.com/fortran/F77_std/f77_std.html )
"Statement labels have a scope of a program unit."
The statement labels (eg, "50") have to be defined within the current "scoping unit", which basically translates in this context to the subroutine/function that the goto call is in (or the main program, if the call is in the main program).
So for instance, in the following program, the main program and both contained subroutines have their own label 50, and the gotos go to "their" line 50.