setjmp.3 (1413B)
1 .TH SETJMP 3 2 .SH NAME 3 setjmp - non-local jumps 4 .SH SYNOPSIS 5 #include <setjmp.h> 6 7 .nf 8 int setjmp(jmp_buf env) 9 void longjmp(jmp_buf env, int val) 10 .fi 11 .SH DESCRIPTION 12 The 13 .BR setjmp () 14 function saves it calling environment in its argument 15 .I env 16 for later use by the 17 .BR longjmp . 18 19 The 20 .BR longjmp () 21 function restores the environment saved 22 by the most recent invocation of 23 .B setjmp 24 in the same invocation of the program 25 with the corresponding 26 .I env 27 as argument. 28 29 If there has been no such invocation, 30 or if the function containing the invocation of 31 .B setjmp 32 has terminated execution, 33 or if the invocation of 34 .B setjmp 35 was within the scope of an identifier with variably modified type 36 and execution has left that scope in interim, 37 the behavior is undefined. 38 .SH RETURN VALUE 39 If the return is from a direct invocation, 40 .B setjmp 41 shall return the value zero. 42 If the return is from a call to 43 .BR longjmp , 44 .B setjmp 45 shall return a nonzero value. 46 47 After the function 48 .B longjmp 49 is called, 50 program execution continues as 51 if the corresponding invocation of 52 .B setjmp 53 has just returned the value specified by 54 .IR val . 55 The function 56 .B longjmp 57 shall not cause the function 58 .B setjmp 59 to return the value 0. 60 If 61 .I val 62 is set to 0, 63 .B setjmp 64 shall return the value 1. 65 .SH STANDARDS 66 .nf 67 ISO/IEC 9899:1999 Section 7.13.1.1 Paragraph 1,2,3 68 ISO/IEC 9899:1999 Section 7.13.2.1 Paragraph 1,2,3,4 69 .fi 70 .SH SEE ALSO 71 .BR setjmp.h (3)