lloonnggjjmmpp() -- General Function (libc)

Perform a non-local goto
#iinncclluuddee <sseettjjmmpp.hh>
iinntt lloonnggjjmmpp(_e_n_v, _r_v_a_l)
jjmmpp_bbuuff _e_n_v; iinntt _r_v_a_l;

The function call is the only mechanism that C provides to transfer control
between functions.  This mechanism is inadequate for some purposes, such as
handling unexpected errors or interrupts  at lower levels of a program.  To
answer this need, lloonnggjjmmpp provides a non-local _g_o_t_o.

lloonnggjjmmpp() restores an environment that had been saved by a previous call to
the  function  sseettjjmmpp().   It returns  the  value  _r_v_a_l  to  the caller  of
sseettjjmmpp(),  just as  if  the sseettjjmmpp()  call  had just  returned.  Note  that
lloonnggjjmmpp() must  not restore the  environment of a routine  that has already
returned.  The type declaration for jjmmpp_bbuuff is in the header file sseettjjmmpp.hh.
The  environment saved  includes the  program  counter, stack  pointer, and
stack  frame.  These  routines  do not  restore register  variables in  the
environment returned.

_E_x_a_m_p_l_e
For an example of this function, see the entry for sseettjjmmpp().

_S_e_e _A_l_s_o
lliibbcc, sseettjjmmpp(), ssiigglloonnggjjmmpp()
ANSI Standard, section 7.6.2.1
POSIX Standard, section 8.1

_N_o_t_e_s
Programmers should note that many user-level routines cannot be interrupted
and  reentered safely.   For  that reason,  improper use  of lloonnggjjmmpp()  and
sseettjjmmpp() can result in  the creation of mysterious and irreproducible bugs.
Do not attempt to use lloonnggjjmmpp() within an exception handler.
