Advertisement
Guest User

Untitled

a guest
Feb 11th, 2015
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.41 KB | None | 0 0
  1. jmp_buf buf; // thread-local
  2. char* msg;   // thread-local
  3.  
  4. // ... some C++ code here, potentially some RAII thingy
  5.  
  6. GeneratedFunc func = (GeneratedFunc)compile_stuff();
  7. if (!setjmp(buf)) {
  8.     // somewhere deep inside, it calls longjmp to jump back to the top function in case a problem happens
  9.     func();
  10. } else {
  11.     printf("error: %s\n", msg);
  12.     // do something about the error here
  13. }
  14.  
  15. // some other C++ code
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement