© Will Briggs 2019Will BriggsC++ for Lazy Programmershttps://doi.org/10.1007/978-1-4842-5187-4_18
18. Exceptions, Move Constructors, Recursion, and O Notation
One needful thing – a better way of handling error conditions – and a few very-nice-to-haves: more efficient copying (“move” functions), functions that call themselves (recursion), and a way to figure how time-efficient your functions are.
How should a program handle runtime errors? Some options:
The ostrich algorithm. Simply hope the problem will never occur: your integers never exceed INT_MAX, your calls to strcpy never overrun the char array, and so on. We do it a lot, and it works! Shall we try it in software for a nuclear reactor? For verifying ...