Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The author complains about his own misunderstanding of, and consequent misuse of exceptions.

Put all your cleanup in destructors. All of it. They exercise that code all the time, on every run. Then, throwing always does the right thing, with no extra effort.



Good thing cleanup code can never fail, what with there being no way to report failure from a destructor.


Destructors can log. Destructors can set flags.


At which point you're dealing with errno C error handling anyway.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: