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.
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 indexed, ordered collection of elements arranged in one or more dimensions, with elements accessed by position.
- type aliaskind of · A type alias is a declaration that gives an existing type an alternative name without creating a distinct type or representation.
- opaque typekind of · An opaque type is a type whose representation and implementation details are hidden from code outside its defining abstraction boundary.
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.

