16,470
社区成员
发帖
与我相关
我的任务
分享
#include <new.h>
double *a = NULL;
a = new(std::nothrow) double[10000]; //编译时出现 identifier 'nothrow',但是nothrow这个常亮在new中明明是有的
if(!a)
AfxMessageBox(_T("内存分配失败!"));
else
……
方法二:double *a;
try
{
a = new double[10000000];
}
catch(??) //catch里面应该捕获什么异常,具体应该怎么写,小弟对catch用法不是很了解。
{
AfxMessageBox(_T("内存分配失败!"));
}
delete a;