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.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.