Topic: Guidelines for using class exception?


Author: fknauss@qualcomm.com (Friedrich Knauss)
Date: 1997/01/06
Raw View
I've just perused [lib.std.exceptions], and it's not clear to me what
exactly all of the derived classes are for. (Some of them I get, some seem
redundant, and some just don't make sense).

Furthermore, [lib.input.ouput] doesn't use any of the existing definitions,
prefering to define their own, derived from exception.

So, how should these be used? Should I primarily use the predefined
exceptions, picking whichever one seems close, or should I define my
own?

If I do derive my own, can I add more data, or will that cause slicing
problems if someone forgets to catch by reference? The standard certainly
doesn't prohibit it, or even suggest that implementations may prohibit it.

If I try to use a predefined class, how do I decide exactly what a
domain exception is, and should it be a runtime exception instead?
--
-- fritzz@qualcomm.com
-- Pain is temporary, glory is forever.
--
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu
]