...
Code Block | ||
---|---|---|
| ||
#include <setjmp.h> const errno_t ESOMETHINGREALLYBAD = 1; jmp_buf exception_env; void g(void) { /* ... */ if (something_really_bad_happens) { longjmp(exception_env, ESOMETHINGREALLYBAD); } /* ... */ } void f(void) { g(); /* ... do the rest of f ... */ } /* ... */ errno_t err = if (setjmp(exception_env); if (err != 0) { /* if we get here, an error occurred ; do not and err indicates what went wrongcontinue processing */ } /* ... */ f(); /* if we get here, no errors occurred */ /* ... */ |
...