Usage of GOTO

objectscriptQuality release 
1.0.0
Id 
OS0023
Rule type 
Code Smell
Severity 

Blocker

Blocker
SQALE characteristic 
  • Changeability
    • Logic
Tags 
confusing, deprecation, maintainability
Remediation function 
Constant/issue
Remediation cost 
2d

Using GOTO for control flow is not recommended. Moreover, it can lead to unsuspected runtime failures. Look at this code for instance:

Method m()
{
    goto out;
out(arg)
    write "Writing", arg," and out", !
}

out is really a subroutine embedded in the method, and it expects an argument. Here however, there isn't any, and the failure will not occur until runtime.