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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.