This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Why does debugging "pure virtual method called" have to be so hard?
- To: oliva at dcc dot unicamp dot br (Alexandre Oliva)
- Subject: Re: Why does debugging "pure virtual method called" have to be so hard?
- From: Joe Buck <jbuck at synopsys dot com>
- Date: Mon, 26 Oct 98 15:55:49 PST
- Cc: jbuck at synopsys dot com, jason at cygnus dot com, mrs at wrs dot com, egcs at cygnus dot com
> It seems to me that a better solution would be to implement
> __pure_virtual in a way similar to terminate and unexpected, i.e., by
> providing a default implementation that abort()s, but allowing the
> user to modify this behavior by running __set_pure_virtual() or
> something like that. The default pure_virtual handler could be
> abort(), and we could provide an alternate handler, say
> __pure_virtual_throw, that would throw
> __pure_virtual_exception (: public std::exception).
That's a lot of work to give meaningful behavior to something that is
undefined. I don't think that the g++ maintainers should work so hard
for this.
Anyone catching exceptions with a wildcard and ignoring what the actual
problem is deserves to lose, so I'm not that concerned about people
who write catch (...) and thereby miss that there is a pure virtual
function being called.