问题,不过我没分了

youwanna 2002-01-12 08:33:48
// ex03005.cpp
// free store exhaustion and the _new_handler function
#include <iostream.h>
#include <stdlib.h>

static void all_gone()
{
cerr << "\n\aThe free store is empty\n";
exit(1);
}

extern void (*_new_handler)();

main()
{
_new_handler = all_gone;
long total = 0;
while (1) {
char *gobble = new char[10000];
total += 10000;
cout << "Got 10000 for a total of " << total << '\n';
}
}
这个程序是如何运行的?
...全文
42 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
youwanna 2002-01-12
  • 打赏
  • 举报
回复
哦,谢谢你,我贴上去以后一查帮助才知道!
我只是觉得自己的c语言学得太水了,好多东西都不知道!唉
phoenixcheng 2002-01-12
  • 打赏
  • 举报
回复
句柄控制。
当内存分配光时,调用出错函数。

15,446

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧