版本3和4间的区别
于2007-08-07 19:55:05修订的的版本3
大小: 1315
编辑: czk
备注:
于2008-02-23 15:37:08修订的的版本4
大小: 1315
编辑: localhost
备注: converted to 1.6 markup
删除的内容标记成这样。 加入的内容标记成这样。
行号 2: 行号 2:
[[Navigation(slides)]] <<Navigation(slides)>>

<<Navigation: 执行失败 ['AllContext' object has no attribute 'values'] (see also the log)>>

B.8 Non-local Jumps: <setjmp.h>

The declarations in <setjmp.h> provide a way to avoid the normal function call and return sequence, typically to permit an immediate return from a deeply nested function call.

int setjmp(jmp_buf env)

  • The macro setjmp saves state information in env for use by longjmp. The return is zero from a direct call of setjmp, and non-zero from a subsequent call of longjmp. A call to setjmp can only occur in certain contexts, basically the test of if, switch, and loops, and only in simple relational expressions.

      if (setjmp(env) == 0)
          /* get here on direct call */
      else
          /* get here by calling longjmp */

void longjmp(jmp_buf env, int val)

  • longjmp restores the state saved by the most recent call to setjmp, using the information saved in env, and execution resumes as if the setjmp function had just executed and returned the non-zero value val. The function containing the setjmp must not have terminated. Accessible objects have the values they had at the time longjmp was called, except that non-volatile automatic variables in the function calling setjmp become undefined if they were changed after the setjmp call.

TCPL/B.08_Non-local_Jumps:_<setjmp.h> (2008-02-23 15:37:08由localhost编辑)

ch3n2k.com | Copyright (c) 2004-2020 czk.