Valid use of goto for error management in C?

FWIF, I find the error handling idiom you gave in the question’s example to be more readable and easier to understand than any of the alternatives given in the answers so far. While goto is a bad idea in general, it can be useful for error handling when done in a simple and uniform manner. In this situation, even though it’s a goto, it’s being used in well-defined and more or less structured manner.

Leave a Comment