Chapter 23. To new, Perchance to throw, Part 2: Pragmatic Issues in Memory Management

Difficulty: 5

Avoid using new(nothrow), and make sure that when you're checking for new failure, you're really checking what you think you're checking.

Solution

In the previous Item, I illustrated and justified the following coding guideline:

  • Any class that ...

Get Exceptional C++ Style 40 New Engineering Puzzles, Programming Problems, and Solutions now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.