纯C中的异常处理库 [英] Exception handling library in pure C

查看:157
本文介绍了纯C中的异常处理库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一些跨平台的c库用于异常处理(在C中实现try/catch)?

Is there some crossplatform c-library for exception handling (to implement try / catch in C)?

我也在寻找文档,说明如何在c ++中实现(中断是如何屏蔽的或类似的东西)

I'm also looking for documentation how it's realized in c++ (how the interrupts are masking or something like this)

推荐答案

您可以尝试 exceptions4c ;它是ANSI C中的一个异常处理库,它支持:throwtrycatchfinally和其他一些好东西.例如,它支持 Dispose模式,因此您可以自动释放资源.您还可以将信号(例如SIGFPESIGSEGV)当作异常来处理.

You can try exceptions4c; it's an exception handling library in ANSI C that supports: throw, try, catch, finally and a few more goodies. For example, it supports the Dispose pattern, so you can automatically release resources. You can also handle signals (such as SIGFPE and SIGSEGV) as if they were exceptions.

它是在setjmplongjmp(标准C库)的基础上实现的,并且是免费软件,因此您可以阅读和修改源代码.

It's implemented on top of setjmp and longjmp (standard C library), and it's free software, so you can read and modify the source code.

哦,我是作者:)请看一下,并与其他备选方案,以查看最适合您的情况.

Oh, by the way, I'm the author :) Please take a look at it, and compare it against other alternatives to see which fits you most.

这篇关于纯C中的异常处理库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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