From: Gary Powell (Gary.Powell_at_[hidden])
Date: 2001-04-11 10:50:58
> It buys you the ability to take actions which may be more appropriate than
> throwing an exception.
> > If you never call an empty function, you'll never get an
> > exception.
> As I have previously posted, throwing an exception in place of an
> can make misuse much harder to debug. An assertion stops the program at
> point of the violation without changing its state, often producing a core
> dump or other information which can be used to look at the program state
> a debugger. An exception causes stack unwinding and other reactions which
> can obscure the cause of the problem.
> It comes down to a question of definitions: is passing a 0 to the
> constructor misuse, or is it allowed? If it's misuse I want an assertion.
Pass in a zero should be allowed. Sometimes I initialize things in one place
and fill them in at another. Calling it is a misuse. But for released code I
want an exception thrown, not a crash.
The idea that released products should crash is one that needs to be tossed.
But hey I write games and if you lose your character, because I wrote buggy
code, its just an excuse for you to play another 1K hrs and build it up
again. No seriously, if you can afford the code space, not crashing is the
way to go. That's heart monitors, games, airplane control systems. Come to
think of it, there are no computer programs in which a released version
should just crash. Shut down with a "I can't go on" is so much nicer.
Sometimes you can actually do something useful on the way out.
By this I mean I understand that some embedded systems are too code space
contained to use exceptions. But by in large, the more robust the code I've
written the better off I and my customers are. It's much easier to ship a
game that doesn't do some feature in an edge case than one that crashes in
that same edge case. Preferably I'll fix it, but if its missed. I hate
working until 4am on a death march to get the crashing bugs out.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk