C++ Enum Class and Error Codes
6 points by raymii
6 points by raymii
“Exceptions are the worst way to handle errors, except for all the other ways.”
I agree it would be good if ‘noexcept’ were the default and any function that could throw had to be labeled ‘throws’ or something, as in Swift. I also like that Swift requires ‘try’ in front of any call to a throwing function.
This would require that logic errors be aborts not exceptions. And the same for out-of-memory, otherwise nearly anything can throw.
This article and the presentations linked from it completely changed the way I think about exception handling. Thanks!