scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

setjmp.man (1359B)


      1 .TH SETJMP 3 scc\-VERSION
      2 .SH NAME
      3 setjmp - save and restore the calling environment for non-local jumps
      4 .SH SYNOPSIS
      5 #include <setjmp.h>
      6 
      7 .nf
      8 int setjmp(jmp_buf env)
      9 void longjmp(jmp_buf env, int val)
     10 .fi
     11 .SH DESCRIPTION
     12 The
     13 .BR setjmp ()
     14 function saves the current execution environment into
     15 .IR env ,
     16 which may later be passed to
     17 .BR longjmp ()
     18 to transfer control back to the point of the
     19 .B setjmp
     20 call.
     21 
     22 The
     23 .BR longjmp ()
     24 function restores the execution environment previously captured by
     25 .B setjmp
     26 in the same program invocation, using the matching
     27 .I env
     28 buffer.
     29 
     30 Calling
     31 .BR longjmp ()
     32 is only valid if the corresponding
     33 .B setjmp
     34 was made in the same program invocation,
     35 the function that called
     36 .B setjmp
     37 has not yet returned,
     38 and execution has not left the scope of any variably modified type
     39 that was in scope at the time of the
     40 .B setjmp
     41 call.
     42 Violating these conditions produces undefined behavior.
     43 .SH RETURN VALUE
     44 When called directly,
     45 .B setjmp
     46 returns zero.
     47 When control is transferred via
     48 .BR longjmp ,
     49 .B setjmp
     50 returns a non-zero value.
     51 
     52 After
     53 .B longjmp
     54 is called, execution resumes as though
     55 .B setjmp
     56 had just returned
     57 .IR val .
     58 If
     59 .I val
     60 is zero,
     61 .B setjmp
     62 returns 1 instead.
     63 .SH STANDARDS
     64 .nf
     65 ISO/IEC 9899:1999 Section 7.13.1.1 Paragraph 1,2,3
     66 ISO/IEC 9899:1999 Section 7.13.2.1 Paragraph 1,2,3,4
     67 .fi
     68 .SH SEE ALSO
     69 .BR setjmp.h (3)