|
Boost : |
From: Daniel Spangenberg (dsp_at_[hidden])
Date: 2003-07-22 01:56:32
David Abrahams schrieb:
> Well, that's not my philosophy FWIW. Mine is:
>
> if the condition is a programmer error, use assert
> otherwise, use a well-documented exception
>
> Occasionally, due to a "no throw" requirement, you have to choose to
> make certain things into programmer errors that would not otherwise
> be, but those conditions should be *very rare*.
I did not want to imply, that this is **your** opinion. Sorry, for the
induced misunderstanding.
Just two points I would like to mention:
1) The above given definition practically makes the exception family
based on logic_error useless. This is even documented in the Our
Standard. 19.1.1/p. 1 says:
"The class logic_error defines the type of objects thrown as exceptions to report
errors presumably
detectable before the program executes, such as violations of logical
preconditions or class invariants."
2) For what kind of errors should be BOOST_ASSERT for? My
assumption is, it is for what you name "programmer error". If so,
shouldn't it actually provide the throw() guarantee? I think, many of
you would like to kill me for this proposal ;-), but for me it seems like
a natural conclusion.
Greetings,
Daniel
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk