This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/23888] should debug mode throw instead of assert?
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 Sep 2005 23:05:30 -0000
- Subject: [Bug libstdc++/23888] should debug mode throw instead of assert?
- References: <20050914214655.23888.bkoz@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From bangerth at dealii dot org 2005-09-14 23:05 -------
I think that's a particularly bad idea: if we use assert(), then we get
an immediate backtrace when run in the debugger. If an exception is
thrown, it is a pain to set a breakpoint in the correct libsupc++ function
where the exception is raised (I wouldn't even know its name right now),
and it will be hard to find where the error was raised. Finding this spot,
however, is the sole purpose of offering the debug mode libstdc++.
Secondly, some user code higher up might have expected an exception from
below and have a throw(std::exception&) clause. Catching all exceptions
might have been a good idea at the time of writing this code, since it was
known that only the called functions would raise certain exceptions, but
now suddenly there are more players that could raise exceptions, and the
additional ones could, without intention, be treated as well in the clause,
masking the fact that debug libstdc++ has in fact raised an exception.
Putting my application writer hat on, I would strongly recommend not to raise
exceptions!
W.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23888