捕获访问冲突异常? [英] Catching access violation exceptions?

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

问题描述

示例

int *ptr;
*ptr = 1000;

我可以使用标准C ++捕获内存访问冲突异常,而不使用任何微软特定的。

can I catch memory access violation exception using standard C++ without using any microsoft specific.

推荐答案

不。当你做坏事时,C ++不会抛出异常,这将导致性能下降。像访问违规或零错误分裂更像是机器异常,而不是你可以捕获的语言级别的东西。

Nope. C++ does not throw an exception when you do something bad, that would incur a performance hit. Things like access violations or division by zero errors are more like "machine" exceptions, rather than language-level things that you can catch.

这篇关于捕获访问冲突异常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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