Before reading the rest of this answer, please read. Go to the statement is considered malicious . If you do not want to read it in full, here is what I consider the key point:
The rampant use of the go to statement immediately leads to the fact that it becomes very difficult to find a meaningful set of coordinates that describe the progress of the process.
Or, to rephrase, the problem with goto is that the program can arrive in the middle of a block of code, without the programmer understanding the state of the program at that point. Standard block-oriented constructions are intended for a clear definition of state transitions; a labeled break intended to transfer a program to a certain known state (outside the containing labeled block).
In a real imperative program, the state is not clearly defined by the boundaries of the blocks, so it is doubtful whether labeled break good idea. If a block changes state that is visible from outside the block, and there are several points for exiting the block, then the marked break equivalent to the goto primitive. The only difference is that instead of getting into the middle of a block with an undefined state, you start a new block with an undefined state.
So, in general, I find the labeled break dangerous. In my opinion, this is a sign that the block should be converted to a function with limited access to the enclosing area.
However, this sample code was clearly the product of a parser generator (the OP commented that it was Xerces source code). And parser generators (or code generators in general) often take liberties with the code that they generate, because they have perfect knowledge of the state, and people should not understand it.
parsifal Feb 19 '13 at 16:19 2013-02-19 16:19
source share