Very likely. I get confused about it sometimes.
By default operator new
throws exception, but you can use overload (std::nothrow
) which return nullptr
on fail.
You’re absolutely right, but this is true for pure C++.
Epic had the ridiculous idea to add GC to cpp. And thanks to this, the ubiquitous checking of nullptr, the lack of information about who owns the resource, behind-the-scenes nulling, etc.