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: Jason Merrill <jason at cygnus dot com>
- Subject: Re: Why does debugging "pure virtual method called" have to be so hard?
- From: Alexandre Oliva <oliva at dcc dot unicamp dot br>
- Date: 26 Oct 1998 05:02:52 -200
- Cc: mrs at wrs dot com (Mike Stump), egcs at cygnus dot com
- References: <199810160157.SAA17725.cygnus.egcs@kankakee.wrs.com> <u93e8pj83q.fsf@yorick.cygnus.com>
Jason Merrill <jason@cygnus.com> writes:
>>>>>> Mike Stump <mrs@wrs.com> writes:
>> How to others feel about calling abort instead of _exit? abort might
>> be more useful.
> I would prefer terminate.
But [lib.terminate] says:
1 Called by the implementation when exception handling must be abandoned
for any of several reasons (_except.terminate_). May also be called
directly by the program.
Calling a pure virtual function is not a case of exception handling,
so it might be strange to call it in such a situation. Of course, one
may argue that calling a pure virtual function has undefined behavior,
and so it *may* call terminate(), but that's not what one would
expect, so I'd rather modify __pure_virtual() so that it calls abort()
or throws an exception of some non-standard type, say,
__pure_virtual_exception, which may end up turning into a call of
unexpected(), then terminate().
--
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:oliva@gnu.org mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil