4 ms·
One of the first codebases I ever worked on professionally allowed gotos as part of its style guide, but only under two conditions: 1. You're using the goto fo
by dblohm7 5y ago
One of the first codebases I ever worked on professionally allowed gotos as part of its style guide, but only under two conditions:
1. You're using the goto for error handling and cleanup in a function; and
2. You only jump in a forward direction.
- TheSockStealer 5y agoUsed like this, it is not much different than a try-catch block
- SXX 5y agoYeah and it's make sense to use it this way since there is no try-catch in C.
- jimmygrapes 5y agoReminds me of BASIC best practices: ON ERROR GOTO handler [try code here] GOTO finally handler: [catch code here] finally: [finally code here]
- thechao 5y agoThe C `switch` statement and `goto` were made for each other, too.