The best C standard library - <setjmp.h> Tutorial In 2024, In this tutorial you can learn Brief introduction,Library variants,Macro library,Library Functions,
setjmp.h header file defines macros setjmp (),the functionlongjmp ()and variable typejmp_buf,the variable type will bypass the normal function call and return rules.
The following lists the variables defined in the header file setjmp.h:
序号 | 变量 & 描述 |
---|---|
1 | jmp_buf 这是一个用于存储宏setjmp()和函数longjmp()相关信息的数组类型。 |
The following is only a macro defined in the library:
序号 | 宏 & 描述 |
---|---|
1 | int setjmp(jmp_buf environment) 这个宏把当前环境保存在变量environment中,以便函数longjmp()后续使用。如果这个宏直接从宏调用中返回,则它会返回零,但是如果它从longjmp()函数调用中返回,则它会返回一个非零值。 |
The following is only a function defined in the header file setjmp.h:
序号 | 函数 & 描述 |
---|---|
1 | void longjmp(jmp_buf environment, int value) 该函数恢复最近一次调用setjmp()宏时保存的环境,jmp_buf参数的设置是由之前调用 setjmp() 生成的。 |