什么是使C ++程序崩溃的最简单的方法? [英] What is the easiest way to make a C++ program crash?

查看:402
本文介绍了什么是使C ++程序崩溃的最简单的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想让一个Python程序与不同的崩溃进程(这是我的手)接口。不幸的是,我接口的程序甚至不可靠的崩溃!所以我想制作一个快速的C ++程序崩溃的目的,但我不知道最好的和最短的方法,有没有人知道要放在我之间:

  int main(){
crashyCodeGoesHere();
}

使我的C ++程序可靠地崩溃


< abort()函数可能是你最好的选择。它是C标准库的一部分,被定义为导致程序异常终止(例如,致命错误或崩溃)。


I'm trying to make a Python program that interfaces with a different crashy process (that's out of my hands). Unfortunately the program I'm interfacing with doesn't even crash reliably! So I want to make a quick C++ program that crashes on purpose but I don't actually know the best and shortest way to do that, does anyone know what to put between my:

int main() {
    crashyCodeGoesHere();
}

to make my C++ program crash reliably

解决方案

The abort() function is probably your best bet. It's part of the C standard library, and is defined as "causing abnormal program termination" (e.g, a fatal error or crash).

这篇关于什么是使C ++程序崩溃的最简单的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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