01-19-2004, 04:42 PM | #3 (permalink) | |||
Addict
Location: Ottawa, ON, Canada
|
Quote:
i.e. Quote:
Quote:
__________________
"A witty saying proves nothing" - Voltaire Last edited by Quadraton; 01-20-2004 at 03:12 PM.. |
|||
01-22-2004, 07:56 AM | #4 (permalink) |
Insane
Location: Seattle
|
Whoa!
catch(...) is one of the worst things to write. Think of it this way. You're writing a device driver. You've got a catch(...) to handle everything. In the device driver, you somehow manage to access memory you shouldn't. Maybe you buffer overwrite, maybe you overread due to a bad format string, who knows? Now the catch(...) catches the AV. How the hell have you helped anyone? They should have AV'd but instead you keep running even though the driver is completely shot and unlikely to work properly from here on in.
__________________
"It's a long story," says I, and let him up. |
01-22-2004, 08:15 PM | #5 (permalink) | |
Addict
Location: Ottawa, ON, Canada
|
That's a good point, but my opinion is that letting an unhandled exception fall through serves no purpose whatsoever. The system doesn't tell you where that unhandled expection occured, either in the error box (Windows), or the core dump (UNIX/Linux), or that it was even an unhandled exception that caused the program to crash in the first place. If anything, you can always just do the following:
Quote:
In the end, I guess it's up to the developer to make the decision, but experience has taught me that unhandled exceptions that fall through can be a headache to debug. And ideally, a well written piece of code should have a catch() for all thrown exceptions, but this method handles the 'just in case".
__________________
"A witty saying proves nothing" - Voltaire Last edited by Quadraton; 01-23-2004 at 12:35 PM.. |
|
Tags |
exception, handling, structured |
|
|