|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2006-02-21 14:31:31
"AlisdairM" <alisdair.meredith_at_[hidden]> writes:
> David Abrahams wrote:
>
>> std::runtime_error loses meaning pretty quickly when you look at it
>> closely, since everything reported by an exception is a runtime error,
>> by definition :)
>
> IIUC though, there remains a distinction between std::runtime_error and
> std::logic_error. The former is intended to report exceptional
> conditions that cannot be detected until runtime, such as losing a
> network connection halfway through a read. The latter is for
> conditions that can (potentially) be avoided by better coding, such as
> failing consistency checks and dividing by zero, where the violating
> arguments can be detected and re-routed up front.
And the latter should almost never be used :). IMO standardizing a
logic_error exception was a big mistake.
-- Dave Abrahams Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk