On 9/25/2014 3:52 PM, Sean Kelly wrote:
Regarding exceptions, they can be used incorrectly, but I think they tend to provide better error handling than return codes *because no one ever checks return codes*. And when you do pathologically handle error codes, the amount of code duplication can be tremendous, and the chance for errors involving improper cleanup can be quite high. Though again, RAII can be of incredible use here.
Yup. A very common source of bugs in C code is all the incorrectly written "if (error) goto cleanup;" code. Exceptions and RAII take care of most of that.