Skip to content
EntityQ307160· pop 11· linked from 45 articles

Also known as csetjmp, <setjmp.h>, <csetjmp>

' is a header defined in the C standard library to provide "non-local jumps": control flow that deviates from the usual subroutine call and return sequence. The complementary functions setjmp and longjmp' provide this functionality.

~11 min read

Article

10 sections
Contents
  • Member functions
  • Member types
  • Caveats and limitations
  • Example usage
  • Simple example
  • Exception handling
  • Cooperative multitasking
  • References
  • Further reading
  • External links

' is a header defined in the C standard library to provide "non-local jumps": control flow that deviates from the usual subroutine call and return sequence. The complementary functions setjmp and longjmp' provide this functionality.

A typical use of setjmp/longjmp is implementation of an exception mechanism that exploits the ability of longjmp to reestablish program or thread state, even across multiple levels of function calls. A less common use of setjmp is to create syntax similar to coroutines.

Available in 7 languages

via Wikidata sitelinks · CC0

Connections

Categories