liveBook · Manning

Jmp_buf

jmp_buf is an opaque C library-defined type representing a saved execution environment for setjmp and longjmp.

How 2 Manning books explain it

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.

Read how Modern C explains jmp_buf →

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.

Read how Modern C, Third Edition explains jmp_buf →

Related concepts

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.