I’m reading <Expert C Programming>
this topic 6.8 is on setjmp/longjmp
mechanism,
compared with throw/catch
this setting obviously has an re-enter callback.
notes,
-zip
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
#include <setjmp.h> jmp_buf buf; banana(){ printf("In banana()n"); longjmp(buf,1); printf("You'll never see this line.n"); } main(){ if (setjmp(buf)) printf("back into mainn"); else{ printf("first time running n"); banana(); } } |