- 论坛徽章:
- 0
|
回复 #19 eveson 的帖子
不过标准 C 可以用 <setjmp.h> 来实现类似异常处理的功能。
The typical use for setjmp/longjmp is for exception handling — by calling longjmp, the program can jump out of many levels of nested function calls without having to go to the trouble of setting flag variables which need to be checked in each function. A problem with the use of setjmp/longjmp is that cleanup (such as closing file descriptors, flushing buffers, freeing heap-allocated memory, etc.) is not conducted automatically.
http://en.wikipedia.org/wiki/Longjmp
[ 本帖最后由 langue 于 2009-1-21 13:23 编辑 ] |
|