- #36
Mark44
Mentor
- 37,806
- 10,205
I recall seeing goto being used in MS Windows internal OS code, possibly in kernel code, but it's been about 10 or 12 years, so I'm not sure of that. One rationale for its use, I believe, was that if something untoward happened, not as much unwinding of the call stack was needed.D H said:The only places where I've seen GOTO used areI have successfully shot down incorporating the single point of entry / single point of return rule into a project's coding standards by innocently asking "so does that mean we can use goto?"
- In ancient code that dates from the 1970s or earlier.
- In not so ancient code where the programmers saw 1970s era code as a "how to" example of best practices.
- In some finite state automata, where the natural transition from one state to another is to go to that other state.
- In organizations that have mandated the single point of entry / single point of return as an anti-pattern.