
AlisdairM wrote:
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.
We know. Think about it from a client PoV. Under what circumstances would you write a catch clause for runtime_error? (Or, to be more exact, under what circumstances would you catch a system_error using the runtime_error base?)