Synopsis
#include <setjmp.h>
int setjmp(jmp_buf env);
Description

setjmp saves its calling environment in the jmp_buf argument env for later use by the longjmp function.

On return is from a direct invocation, setjmp returns the value zero. If the return is from a call to the longjmp function, the setjmp macro returns a nonzero value determined by the call to longjmp.

The ISO standard does not specify whether setjmp is a macro or an identifier declared with external linkage. If a macro definition is suppressed in order to access an actual function, or a program defines an external identifier with the name setjmp, the behavior of setjmp is undefined.

Portability

setjmp conforms to ISO/IEC 9899:1990 (C90) and ISO/IEC 9899:1999 (C99).

See also

longjmp