© Will Briggs 2019
Will BriggsC++ for Lazy Programmershttps://doi.org/10.1007/978-1-4842-5187-4_18

18. Exceptions, Move Constructors, Recursion, and O Notation

Will Briggs
Lynchburg, VA, USA
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 ...

Get C++ for Lazy Programmers: Quick, Easy, and Fun C++ for Beginners now with the O’Reilly learning platform.

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