⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 longjmp.gml

📁 开放源码的编译器open watcom 1.6.0版的源代码
💻 GML
字号:
.func longjmp
#include <setjmp.h>
void longjmp( jmp_buf env, int return_value );
.ixfunc2 'Non-local jumps' &func
.funcend
.desc begin
The &func function restores the environment saved by the most recent
call to the
.kw setjmp
function with the corresponding
.kw jmp_buf
argument.
.np
It is generally a bad idea to use &func to jump out of an interrupt
function or a signal handler (unless the signal was generated by the
.kw raise
function).
.desc end
.return begin
After the &func function restores the environment, program
execution continues as if the corresponding call to
.kw setjmp
had just returned the value specified by
.arg return_value.
If the value of
.arg return_value
is 0, the value returned is 1.
.return end
.see begin
.seelist longjmp setjmp
.see end
.exmp begin
#include <stdio.h>
#include <setjmp.h>

jmp_buf env;

rtn()
  {
    printf( "about to longjmp\n" );
    longjmp( env, 14 );
  }
.exmp break
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 );
    }
  }
.exmp output
after setjmp 0
about to longjmp
back from longjmp 14
.exmp end
.class ANSI
.system

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -