1SETJMP(3P) POSIX Programmer's Manual SETJMP(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
11
13 setjmp — set jump point for a non-local goto
14
16 #include <setjmp.h>
17
18 int setjmp(jmp_buf env);
19
21 The functionality described on this reference page is aligned with the
22 ISO C standard. Any conflict between the requirements described here
23 and the ISO C standard is unintentional. This volume of POSIX.1‐2008
24 defers to the ISO C standard.
25
26 A call to setjmp() shall save the calling environment in its env argu‐
27 ment for later use by longjmp().
28
29 It is unspecified whether setjmp() is a macro or a function. If a macro
30 definition is suppressed in order to access an actual function, or a
31 program defines an external identifier with the name setjmp, the behav‐
32 ior is undefined.
33
34 An application shall ensure that an invocation of setjmp() appears in
35 one of the following contexts only:
36
37 * The entire controlling expression of a selection or iteration
38 statement
39
40 * One operand of a relational or equality operator with the other op‐
41 erand an integral constant expression, with the resulting expres‐
42 sion being the entire controlling expression of a selection or
43 iteration statement
44
45 * The operand of a unary '!' operator with the resulting expression
46 being the entire controlling expression of a selection or iteration
47
48 * The entire expression of an expression statement (possibly cast to
49 void)
50
51 If the invocation appears in any other context, the behavior is unde‐
52 fined.
53
55 If the return is from a direct invocation, setjmp() shall return 0. If
56 the return is from a call to longjmp(), setjmp() shall return a non-
57 zero value.
58
60 No errors are defined.
61
62 The following sections are informative.
63
65 None.
66
68 In general, sigsetjmp() is more useful in dealing with errors and
69 interrupts encountered in a low-level subroutine of a program.
70
72 None.
73
75 None.
76
78 longjmp(), sigsetjmp()
79
80 The Base Definitions volume of POSIX.1‐2008, <setjmp.h>
81
83 Portions of this text are reprinted and reproduced in electronic form
84 from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
85 -- Portable Operating System Interface (POSIX), The Open Group Base
86 Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
87 cal and Electronics Engineers, Inc and The Open Group. (This is
88 POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
89 event of any discrepancy between this version and the original IEEE and
90 The Open Group Standard, the original IEEE and The Open Group Standard
91 is the referee document. The original Standard can be obtained online
92 at http://www.unix.org/online.html .
93
94 Any typographical or formatting errors that appear in this page are
95 most likely to have been introduced during the conversion of the source
96 files to man page format. To report such errors, see https://www.ker‐
97 nel.org/doc/man-pages/reporting_bugs.html .
98
99
100
101IEEE/The Open Group 2013 SETJMP(3P)