Possible Duplicate:
In C++ what are the benefits of using exceptions and try / catch instead of just returning an error code?
I am wondering what’s the pros & cons of using Try/Catch VS returning error code ?
Should I almost always prefere using try catch in c++ ?
Do you still use return error code in your project ? If so why ?
Use error codes for incorrect functionalities of your program and try catch in places where you expect the program to crash. try/catch blocks usually make your program run slower. If you suspect an error in your code, it’s better to check and return an error code rather than throwing an exception.