© 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
(1)
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.

Exceptions

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

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