This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Why does debugging "pure virtual method called" have to be so hard?



> 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.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]