引发未处理的异常 [英] Provoke a unhandled exception
本文介绍了引发未处理的异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
I want to test a bunch of "application crash dump generators" like good old Dr. Watson.
在C/C ++中由于未处理的异常而引发应用程序崩溃的最简单方法是什么?
What is the easiest way to provoke an application crash over a unhandled exception in C/C++?
推荐答案
技术上取消引用NULL
指针只是一种未定义的行为,而不是保证的崩溃,实际上,它将以几乎绝对的确定性崩溃:
While technically dereferencing a NULL
pointer is simply an undefined behavior, not a guaranteed crash, in practice it would crash with nearly absolute certainty:
(*((int*)0))=0;
这篇关于引发未处理的异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文