1SETJMP(P) POSIX Programmer's Manual SETJMP(P)
2
3
4
6 setjmp - set jump point for a non-local goto
7
9 #include <setjmp.h>
10
11 int setjmp(jmp_buf env);
12
13
15 A call to setjmp() shall save the calling environment in its env argu‐
16 ment for later use by longjmp().
17
18 It is unspecified whether setjmp() is a macro or a function. If a
19 macro definition is suppressed in order to access an actual function,
20 or a program defines an external identifier with the name setjmp, the
21 behavior is undefined.
22
23 An application shall ensure that an invocation of setjmp() appears in
24 one of the following contexts only:
25
26 * The entire controlling expression of a selection or iteration state‐
27 ment
28
29 * One operand of a relational or equality operator with the other op‐
30 erand an integral constant expression, with the resulting expression
31 being the entire controlling expression of a selection or iteration
32 statement
33
34 * The operand of a unary '!' operator with the resulting expression
35 being the entire controlling expression of a selection or iteration
36
37 * The entire expression of an expression statement (possibly cast to
38 void)
39
40 If the invocation appears in any other context, the behavior is unde‐
41 fined.
42
44 If the return is from a direct invocation, setjmp() shall return 0. If
45 the return is from a call to longjmp(), setjmp() shall return a non-
46 zero value.
47
49 No errors are defined.
50
51 The following sections are informative.
52
54 None.
55
57 In general, sigsetjmp() is more useful in dealing with errors and
58 interrupts encountered in a low-level subroutine of a program.
59
61 None.
62
64 None.
65
67 longjmp() , sigsetjmp() , the Base Definitions volume of
68 IEEE Std 1003.1-2001, <setjmp.h>
69
71 Portions of this text are reprinted and reproduced in electronic form
72 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
73 -- Portable Operating System Interface (POSIX), The Open Group Base
74 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
75 Electrical and Electronics Engineers, Inc and The Open Group. In the
76 event of any discrepancy between this version and the original IEEE and
77 The Open Group Standard, the original IEEE and The Open Group Standard
78 is the referee document. The original Standard can be obtained online
79 at http://www.opengroup.org/unix/online.html .
80
81
82
83IEEE/The Open Group 2003 SETJMP(P)