Jmp_buf
jmp_buf is an opaque C library-defined type representing a saved execution environment for setjmp and longjmp.
Modern C
jmp_buf is an opaque C library-defined array type that represents a saved execution context for setjmp and longjmp.
- How it is used
- Uses an opaque saved context to route parser failures and other exceptional conditions back to a central control point.
- How deep it goes
- Explains declaration, normal setjmp return, nonlocal transfer, and scope validity, while deferring implementation details of the opaque object.
- Examples
- Demonstrates a recursive descent parser using a switch, helper-function longjmp calls, and distinct exceptional-state values.
- What you can do after
- Apply it via setjmp and longjmp to centralize exceptional control flow without continuing execution in the jumping caller.
Modern C, Third Edition
jmp_buf is an opaque C type for storing the execution environment used by setjmp and longjmp.
- How it is used
- Provides a nonlocal jump target for terminating recursive-descent processing and returning a condition to a surrounding dispatcher.
- How deep it goes
- Explains opacity, normal setjmp return, longjmp transfer, lifetime, validity, and nonreturning behavior, but not representation internals.
- Examples
- Uses a recursive-descent parser, a switch dispatcher, and an end_line function that calls longjmp on output failure.
- What you can do after
- Apply jmp_buf with setjmp and longjmp while preserving the jump target's scope and execution context.
Also covered in
What to know first
- setjmp/longjmpThe setjmp/longjmp mechanism is a C nonlocal-control-flow facility that saves an execution context and later restores it to transfer control across function-call boundaries.
Related concepts
- setjmp/longjmpused by · The setjmp/longjmp mechanism is a C nonlocal-control-flow facility that saves an execution context and later restores it to transfer control across function-call boundaries.
- arraykind of · An array is an ordered collection of elements organized in one or more dimensions and accessible by position or index.
- opaque typekind of · An opaque type is a type whose representation and implementation details are hidden from code outside its defining abstraction boundary.
- type aliaskind of · A type alias is a declaration that gives a type or type expression an alternative name without introducing a distinct nominal type.
Questions about jmp_buf
What is jmp_buf?
jmp_buf is an opaque C library-defined type representing a saved execution environment for setjmp and longjmp.
Which Manning books explain jmp_buf?
Modern C and Modern C, Third Edition.
What should I know before learning jmp_buf?
Manning books that teach jmp_buf usually introduce setjmp/longjmp first.
What is jmp_buf a kind of?
Jmp_buf is a kind of array. An array is an ordered collection of elements organized in one or more dimensions and accessible by position or index.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

