3 ms·
I was at JPL when we were developing these standards. C was still pretty new there, they used FORTRAN almost exclusively before that. In practice, this rule ha
by hyc_symas 11y ago
I was at JPL when we were developing these standards. C was still pretty new there, they used FORTRAN almost exclusively before that.
In practice, this rule had little impact. The only time you could justify using a goto was for cleanup, and you could always end-run around the rule.
... blah blah ...
if (error)
goto fail;
... blah blah ...
if (error)
goto fail;
... blah blah ...
fail:
... cleanup ...
just gets turned into
do {
... blah blah ...
if (error)
break;
... blah blah ...
if (error)
break;
... etc...
} while (0);
if (error) {
... cleanup ...
}