Reputation: 1270
If I use new
and get std::bad_alloc
compiler do not call constructor because of exception. But how does it works with the nothrow new
cause we get pointer in every case? Is there special paragraph in standard for this case?
Upvotes: 1
Views: 322
Reputation: 52611
[expr.new]/16 ... if the allocation function returns null, initialization shall not be done, the deallocation function shall not be called, and the value of the new-expression shall be null.
Upvotes: 6