有哪些"好"方法使用的longjmp对于C错误处理/ setjmp的? [英] What are some "good" ways to use longjmp/setjmp for C error handling?

查看:158
本文介绍了有哪些"好"方法使用的longjmp对于C错误处理/ setjmp的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须使用下一个项目,我用的longjmp / setjmp的处理错误的思想,因为我认为这将是更容易在一个中央处理错误地方不是返回codeS。我想AP preciate如果有关于如何做到这一些线索。

I have to use C for one project and I am thinking of using longjmp/setjmp for error handling as I think it will be much easier to handle error in one central place than return codes. I would appreciate if there are some leads on how to do this.

我特别关注,如果发生任何此类错误资源清理被正确完成。

I am particularly concerned with resource cleanup being correctly done if any such error occurs.

另外我该如何处理使用他们,导致多线程程序错误?

Also how do I handle errors that result in multi-threaded programs using them?

更妙的是,有没有已经存在的错误/异常处理一些C库?

Even better, is there some C library that already exists for error/exception handling?

推荐答案

有一个在这个例子/教程:结果
<一href=\"http://www.di.unipi.it/~nids/docs/longjump%5Ftry%5Ftrow%5Fcatch.html\">http://www.di.unipi.it/~nids/docs/longjump_try_trow_catch.html

Have a look at this example/tutorial:
http://www.di.unipi.it/~nids/docs/longjump_try_trow_catch.html

这篇关于有哪些&QUOT;好&QUOT;方法使用的longjmp对于C错误处理/ setjmp的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆