Topic: standard error classes


Author: 100754.2730@compuserve.com (Martin Aupperle)
Date: 1996/07/20
Raw View
The DWP defines classes logic_error and runtime_error.

1.)  A "logic error" is something that can theoretically  be detected
by statical analysis of the program.  A out_of_range error is such a
thing. The DWP says: "The class out_of_range defines the type of
objects thrown as exceptions to report an argument value not in its
expected range.".

2.) A "runtime_error" is something that can be detected only when the
program actually runs. A range_error is such an error. The DWP says:
"The class range_error defines the type of objects thrown as
exceptions to report range errors.".

Now, where is the difference here? When shall I throw which?


3.) The DWP defines 6 standard exception classes, but does not give a
satisfactory explanation when to use which. Maybe my English is too
bad but I don't understand the meaning of the following:

domain_error, length_error, out_of_range and range_error. Can someone
explain what the committee had in mind here?


Thank you - Martin
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]