View Single Post
Old Oct 29th, 2005, 10:35 AM   #43
lectricpharaoh
SEXY SHOELESS GOD OF WAR!
 
lectricpharaoh's Avatar
 
Join Date: Jun 2005
Location: Wet west coast of Canada
Posts: 1,188
Rep Power: 5 lectricpharaoh will become famous soon enough
Quote:
Originally Posted by DaWei
Quote:
Originally Posted by MrSmiley
DaWei, what is your take on c++'s try...catch excetion handeling?
I think it's a good mechanism to use for extraordinary errors or in situations where you want some class of errors to be handled from a central location. I would never use it in place of simple status checks.
I agree with this 100%. Exceptions are fine when the error is caused by something completely beyond your control, such as hardware failure. However, exceptions are also an order of magnitude more expensive from an efficiency standpoint than a simple compare, and as such, shouldn't be used as a replacement for checking return values.

This is one of my main beefs with Java. The language designers opted to use exceptions for nearly all error conditions; you see things like a method with a void return type throwing an exception, where returning a success/failure code would seem to be much easier. Of course, this isn't a flaw of the language itself, but rather of the design of the standard libraries.
__________________
And once again, Probability proves itself willing to sneak into a back alley and service Drama as would a copper-piece harlot.
- Vaarsuvius, Order of the Stick
lectricpharaoh is offline   Reply With Quote