23 lines
390 B
C
23 lines
390 B
C
|
#include <stdio.h>
|
||
|
#include <setjmp.h>
|
||
|
jmp_buf env;
|
||
|
|
||
|
void 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 );
|
||
|
}
|
||
|
}
|