Exception libraries for C (not C++)

时光毁灭记忆、已成空白 提交于 2019-12-01 02:36:12

问题


I am rolling my own exception library for C and would like good examples to examine.

So far, I have been looking at David Hanson's: http://drhanson.net/work/

But I know I've seen other ones available in the past. Can you send me some additional pointers?

Thanks,

SetJmp


回答1:


Here is one, compatible with C89 and implementing the try/catch/finally schema as can be found in other OO languages.




回答2:


Symbian implemented exceptions (called 'leaves') in terms of longjmp. This was C++ code, but translatable to C. There's a previous post about this.




回答3:


Take a look at XXL: http://www.zork.org/xxl/

I found it quite usable in a previous project. Hasn't been updated in a while though.




回答4:


CException is simple exception handling in C. It is significantly faster than full-blown C++ exception handling but loses some flexibility. It is portable to any platform supporting setjmp/longjmp.



来源:https://stackoverflow.com/questions/1410329/exception-libraries-for-c-not-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!