...
When using the nonthrowing form, it is imperative to check that the return value is not nullptr
before accessing the resulting pointer. When using either form, be sure to comply with ERR30-CPP. Try to recover gracefully from unexpected errorsDo not call std::terminate(), std::abort(), or std::_Exit().
Noncompliant Code Example
...
[ISO/IEC 14882-2014] | 18.6.1.1, "Single-object Forms" |
[ISO/IEC 9899:2011] | Section 7.20.3, "Memory management functions" |
[Meyers 95] | Item 7. Be prepared for out-of-memory conditions. |
[Seacord 2013b] | Chapter 4, "Dynamic Memory Management" |
...