有哪些"好"方法使用的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?
有一个在这个例子/教程:结果
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