Fri Jul 30 07:23:28 CEST 2010
Error handlers as goto labels
What you see a lot in C code is a "goto error" sprinkled around code,
where the "error" points to code that performs some error recovery
before function return. The problem with this is that you don't know
where the error condition came from when you set a debugger breakpoint
on the "error" label.
The solution is to place the handling code in a separate function.
Instead of "goto error" one would use:
This way a breakpoint can be set on "handle_error" and from the
backtrace it is clear which branch of the code generated it.