Is it allowed to do longjmp() multiple times for one setjmp() call?
问题 In my understanding, a typical usage of setjmp() and longjmp() is exception handling (usage in libpng should be a famous example of that) and there will be at most one call of longjmp() for one setjmp() call. Is it safely allowed to do longjmp() multiple times for one setjmp() call like this? #include <stdio.h> #include <setjmp.h> jmp_buf jb; int i; int main(void) { i = 0; setjmp(jb); printf("%d\n", i); i++; if (i < 10) longjmp(jb, 1); return 0; } Output: 0 1 2 3 4 5 6 7 8 9 I successfully