jmp_buf is an opaque C object type used by setjmp and longjmp to preserve a jump target. Unlike a goto label, it may be declared outside the function containing the jump, provided it remains alive and valid. section 19.5
Parser control-flow interface
A local jmp_buf can surround a recursive descent operation: switch (setjmp(jmpTarget)) { case 0: descend(..., jmpTarget); break; case error: /* report condition */ break; }. Normal control flow selects case 0; longjmp transfers execution back to setjmp, which then produces the condition value. section 19.5
Remember these validity rules:
- Keep the jmp_buf's declaration scope active when calling longjmp. section 19.5
- Preserve the complete setjmp context; leaving its scope invalidates the jump target. section 19.5
- Treat longjmp as nonreturning; control resumes at setjmp rather than at the longjmp call. section 19.5
Figure 19.2 Control flow with setjmp and longjmp: longjmp jumps to the position marked by setjmp.
Trace how longjmp returns control to the position marked by setjmp. section 19.5

