Gamingphreek
Lifer
Perhaps I am mistaken, but aren't 'goto' statements bad for other reasons:
A. The compiler cannot optimize a goto statement like a function call. For instance, a function may be inlined instead of creating a stack frame in certain cases (While a goto doesn't need a new stack frame, there are other optimizations that I am sure can be used).
B. It is bad for pipelining and branch prediction (There is a good chance this point is wrong because I would imagine that the branch prediction is sophisticated enough to follow a jump or long jump).
C. Additionally, having goto statements everywhere make code readability an absolute nightmare. (Plus, chances are if a person is using extensive goto statements, they are not a good programmer already. Thus, the code probably has no comments and bad formatting).
D. Can potentially get into infinite loops.
E. When used in a multi-threaded environment, unlocking and locking critical sections with a goto anywhere in your code would be a nightmare of epic proportions.
-Kevin
A. The compiler cannot optimize a goto statement like a function call. For instance, a function may be inlined instead of creating a stack frame in certain cases (While a goto doesn't need a new stack frame, there are other optimizations that I am sure can be used).
B. It is bad for pipelining and branch prediction (There is a good chance this point is wrong because I would imagine that the branch prediction is sophisticated enough to follow a jump or long jump).
C. Additionally, having goto statements everywhere make code readability an absolute nightmare. (Plus, chances are if a person is using extensive goto statements, they are not a good programmer already. Thus, the code probably has no comments and bad formatting).
D. Can potentially get into infinite loops.
E. When used in a multi-threaded environment, unlocking and locking critical sections with a goto anywhere in your code would be a nightmare of epic proportions.
-Kevin