[Bug libstdc++/23888] should debug mode throw instead of assert?
bangerth at dealii dot org
gcc-bugzilla@gcc.gnu.org
Wed Sep 14 23:05:00 GMT 2005
------- 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
More information about the Gcc-bugs
mailing list