Why does debugging "pure virtual method called" have to be so hard?
Joe Buck
jbuck@synopsys.com
Mon Oct 26 20:11:00 GMT 1998
> 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.
More information about the Gcc
mailing list