Go to the first, previous, next, last section, table of contents.


longjmp

Syntax

#include <setjmp.h>

void longjmp(jmp_buf env, int val);

Description

This function reverts back to a CPU state that was stored in env by setjmp (see section setjmp). The state includes all CPU registers, so any variable in a register when setjmp was called will be preserved, and all else will be indeterminate.

The value passed as val will be the return value of setjmp when it resumes processing there. If val is zero, the return value will be one.

Return Value

This function does not return.

Portability

ANSI, POSIX

Example

jmp_buf j;
if (setjmp(j))
  return;
do_something();
longjmp(j, 1);


Go to the first, previous, next, last section, table of contents.