Hacker News new | past | comments | ask | show | jobs | submit login

I wonder, too. I sure agree with them that it's possible to mess up with exceptions, sure, but the alternative -- using error codes is also prone to bugs. For starters:

1) It means that you have to check the return value of every call. Miss one, and errors get ignored, which can result memory corruption or worse.

2) Checking return codes after every function call results in terribly verbose code/ Whereas exception-based error handling, when used in the right way, only needs catch() statements in places where the error is actually handled.

2) Every function has to return a status code. This hijacks the return value, meaning that you cannot simply return a value anymore, you always need to use output parameters.




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

Search: