Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C/C++ v10.0 : C library - <b>synopsis:</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <setjmp.h>
    void longjmp( jmp_buf env, int return_value );

Description:
    The longjmp function restores the environment saved by the most recent
    call to the  setjmp function with the corresponding  jmp_buf argument.

Returns:
    After the longjmp function restores the environment, program execution
    continues as if the corresponding call to  setjmp had just returned the
    value specified by return_value.  If the value of return_value is 0, the
    value returned is 1.

See Also:
    setjmp

Example:
    #include <stdio.h>
    #include <setjmp.h>
    jmp_buf env;

    rtn()
      {
        printf( "about to longjmp\n" );
        longjmp( env, 14 );
      }

    void main()
      {
        int ret_val = 293;

        if( 0 == ( ret_val = setjmp( env ) ) ) {
          printf( "after setjmp %d\n", ret_val );
          rtn();
          printf( "back from rtn %d\n", ret_val );
        } else {
          printf( "back from longjmp %d\n", ret_val );
        }
      }

    produces the following:

    after setjmp 0
    about to longjmp
    back from longjmp 14

Classification:
    ANSI

Systems:
    All

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson