|
Authored by: Anonymous on Sunday, May 20 2012 @ 02:35 PM EDT |
If you do use a GOTO, include a comment containing the corresponding COMEFROM.
[ Reply to This | Parent | # ]
|
|
Authored by: DieterWasDriving on Monday, May 21 2012 @ 05:08 AM EDT |
I rarely use goto in C.
I actually use it less than I should, just because it has such a bad reputation.
A reputation that is well deserved in languages such as early BASIC where it
hampered simple analysis, but largely incorrect in languages where it can
clearly communicate an exceptional control flow.
The alternatives of restructuring code to awkwardly test flags or use multiple
levels of subroutines can avoid 'goto', but they result in less understandable
code. And they often introduce artificial constraints that prevent the compiler
from optimizing. We've had compilers that can do whole-function analysis of
control flow for about a quarter century -- a 'goto' statement is easily
optimized.
[ Reply to This | Parent | # ]
|
|
|
|
|