Everything

longjmp


Restores the function execution environment saved by the setjmp function, and transfers control to the program location at which the setjmp function was called.

[Format]

#include <setjmp.h>

void longjmp (jmp_buf env, long ret);

[Parameters]

env Pointer to storage area in which execution environment was saved

ret Return code to setjmp function

[Remarks]

From the storage area specified by the first parameter env, the longjmp function restores the function execution environment saved by the most recent invocation of the setjmp function in the same program, and transfers control to the program location at which that setjmp function was called. The value of the second parameter ret of the longjmp function is returned as the setjmp function return value. However, if ret is 0, the value 1 is returned to the setjmp function as a return value.

If the setjmp function has not been called, or if the function that called the setjmp function has already executed a return statement, the operation of the longjmp function is not guaranteed.