今天在看有关代码的时候,发现一个写法
auto ret = new (std::nothrow) GLViewImpl;
new(std::nothrow)在因内存不足分配内存失败时并不抛出异常,而是将返回值置空。虽然我们在用普通的new时也会这样写,但是并没有什么卵用,因为会直接抛出异常。