小编Cha*_*hin的帖子

C++:内存不足时会返回什么?

当我编码如下时,它将返回'null'并且不会发生异常.

Char* pStr = new(std::nothrow)Char(10);
Run Code Online (Sandbox Code Playgroud)

那么不在new运算符上使用'nothrow'参数呢?它是否也返回'null'?如果是这样,为什么建议使用'nothrow'参数?

Char* pStr = new Char(10);
Run Code Online (Sandbox Code Playgroud)

谢谢你的时间.

c++ out-of-memory nothrow

0
推荐指数
1
解决办法
729
查看次数

标签 统计

c++ ×1

nothrow ×1

out-of-memory ×1