2 ms·
> You can use new without exceptions, but you can't detect OOM then, if I'm not mistaken. You can detect the same errors with and without exceptions - the noth
by account42 6y ago
> You can use new without exceptions, but you can't detect OOM then, if I'm not mistaken.
You can detect the same errors with and without exceptions - the nothrow variant returns nullptr on error. Due to overcommit, neither can be relied on to detect OOM in practice.
> If you construct your object and then acquire a resource in it later, from a function that can return an error without throwing, then you introduce complexity in the destructor and may risk errors more.
Not neccessrily, e.g. free and delete are both no-ops for nullptr.