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