在运行程序中没有获得双双免费或损坏错误
我编写了以下程序,该程序应该给出双免费损坏的运行时错误。
#include <iostream>
#include <memory>
using namespace std;
int main()
{
shared_ptr<int> shared3(new int);
*shared3 = 9;
int *raw = shared3.get();
delete raw;
return 0;
}
核心转储应该已经来了,但事实并非如此。请告诉我如何在环境中获得双重自由运行时错误?
I have written the following program which should give runtime error of double free corruption.
#include <iostream>
#include <memory>
using namespace std;
int main()
{
shared_ptr<int> shared3(new int);
*shared3 = 9;
int *raw = shared3.get();
delete raw;
return 0;
}
A core dump should have come but it didn't. Please tell me how can I get double free runtime error in my environment?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论