|
|
1.1 root 1:
2:
3: longjmp() General Function longjmp()
4:
5:
6:
7:
8: Return from a non-local goto
9:
10: #include <setjmp.h>
11: iinntt lloonnggjjmmpp(_e_n_v, _r_v_a_l) jjmmpp_bbuuff _e_n_v; iinntt _r_v_a_l;
12:
13: The function call is the only mechanism that C provides to trans-
14: fer control between functions. This mechanism is inadequate for
15: some purposes, such as handling unexpected errors or interrupts
16: at lower levels of a program. To answer this need, lloonnggjjmmpp
17: provides a non-local _g_o_t_o.
18:
19: lloonnggjjmmpp restores an environment that had been saved by a previous
20: call to the function sseettjjmmpp. It returns the value _r_v_a_l to the
21: caller of sseettjjmmpp, just as if the sseettjjmmpp call had just returned.
22: Note that lloonnggjjmmpp must not restore the environment of a routine
23: that has already returned. The type declaration for jjmmpp_bbuuff is
24: in the header file sseettjjmmpp.hh. The environment saved includes the
25: program counter, stack pointer, and stack frame. These routines
26: do not restore register variables in the environment returned.
27:
28: ***** Example *****
29:
30: For an example of this function, see the entry for longjmp.
31:
32: ***** See Also *****
33:
34: general functions, setjmp()
35:
36: ***** Notes *****
37:
38: Programmers should note that many user-level routines cannot be
39: interrupted and reentered safely. For that reason, improper use
40: of longjmp and setjmp can result in the creation of mysterious
41: and irreproducible bugs. Do not attempt to use longjmp within an
42: exception handler.
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64: COHERENT Lexicon Page 1
65:
66:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.