try/catch segment fault 的第三方类库

segvcatch

 

About

This is a crossplatform C++ library designed to convert a hardware exceptions, such as segmentation fault, or floating point errors, into a software language exceptions, which can be handled later with a try/catch construction.

Other words, it's a crossplatform structured exception handling (SEH).

For example, this code is working fine:

try
{
   
*(int*)0=0;
}
catch(std::exception& e)
{
    std
::cerr <<"Exception catched : "<< e.what()<< std::endl;
}

不错,经测试,可以用。
但是有些心虚,应为毕竟segment fault 之后,堆栈就已经被破坏了。。。 

原文链接: https://www.cnblogs.com/wangshuai901/archive/2012/03/14/2397095.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍

    try/catch segment fault 的第三方类库

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/44165

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年2月8日 下午8:49
下一篇 2023年2月8日 下午8:50

相关推荐