Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- jmp_buf buf; // thread-local
- char* msg; // thread-local
- // ... some C++ code here, potentially some RAII thingy
- GeneratedFunc func = (GeneratedFunc)compile_stuff();
- if (!setjmp(buf)) {
- // somewhere deep inside, it calls longjmp to jump back to the top function in case a problem happens
- func();
- } else {
- printf("error: %s\n", msg);
- // do something about the error here
- }
- // some other C++ code
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement