Geoff wrote:
If you understand the domain of the data and you
understand the process enough to write asserts,
you certainly better understand it well enough to
write a recovery handler for instances at the
boundary conditions where the assertions will
fire and you must test them.
But that makes no sense. What kind of recovery will
you make for a situation that can't happen? Why would
a programmer write recovery code for something that
can't happen? My understanding of assertions is that
they document the logic of the code during development,
so that mistakes are quickly exposed. By your premise,
every time a programmer adds an assertion he has to
write the recovery code for when that assertion fails,
even though he believes that it cannot happen. The only
possible result of this is that he will use no assertions
at all.
Not quite. The other one is that his program fills up with untested
(and surely incorrect) "recovery" code. This is one danger of
[ comp.lang.c++.moderated. First time posters: Do this! ]