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