6.2. Restore Calling Environment

6.2.1. The longjmp function

Synopsis
#include <setjmp.h>

int longjmp (jmp_buf env , int val );

Description

The longjmp function restores the calling environment saved by the most recent invocation of the setjmp macro in the same invocation of the program, with the corresponding jmpbuf argument. If there has been no such invocation or if the function containing the invocation of the setjmp macro has terminated execution than the the behavior is undefined.

Returns

After longjmp is completed, program execution continues as if the corresponding invocation of the setjmp macro had just returned the value specified by val. The longjmp function cannot cause the setjmp macro to return the value 0: if val is 0, the setjmp macro returns the value 1.

Implementation Notes