4 ms·
In C GOTO is often by far the cleanest solution for error handling. Everything else turns into an ugly, unreadable mess in functions that need to free resour
by the_duke 6y ago
In C GOTO is often by far the cleanest solution for error handling.
Everything else turns into an ugly, unreadable mess in functions that need to free resources or do some kind of cleanup.
- Uptrenda 6y agoI've seen the goto error-handling approach used now in SDKs written by developers from companies like Microsoft, Nvidia, and Nordic Semiconductor. It really does seem to be the best way to do it. And it's simple. Mess something up... goto cleanup... Seems fine to me!
- centimeter 6y agoMy comment has nothing to do with error handling. I was addressing a false claim about performance.