[APPROVE] __cxa_pure_virtual()

Jonathan Larmour jifl@eCosCentric.com
Thu Mar 27 19:58:00 GMT 2003


Bart Veer wrote:
>>>>>>"Jifl" == Jonathan Larmour <jifl@eCosCentric.com> writes:
> 
> 
>     Jifl> Bart Veer wrote:
>     >> I have just committed a patch to CYGPKG_INFRA to provide an
>     >> implementation of __cxa_pure_virtual() that is appropriate for eCos,
>     >> overriding the one in libsupc++. 
>     >> 
>     >> http://sources.redhat.com/ml/ecos-patches/2003-03/msg00209.html
> 
>     Jifl> No objection in principle, although I think you could add a
>     Jifl> diag_printf after the CYG_FAIL saying the same thing so
>     Jifl> there is some potential diagnostic if people don't have
>     Jifl> asserts enabled.
> 
>     Jifl> Perhaps even
>     Jifl> #ifdef CYGDBG_USE_ASSERTS
>     Jifl> CYG_FAIL
>     Jifl> #else
>     Jifl> diag_printf
>     Jifl> #endif
> 
> No. __cxa_pure_virtual() should never get called. Even when still
> debugging, there are very few applications sufficiently broken that
> __cxa_pure_virtual() would get called. In non-debug builds we want a
> minimal implementation, and having a diag_printf() in there would be a
> waste of code space.

Fair point.

> Arguably we should go even further and in non-debug builds alias this
> to cyg_assert_fail() or some other dummy function, saving a couple
> more bytes.

Well, in the future we should have a general way to deal with program 
termination/abort whatever. abort() has too many existing semantic 
requirements, but to achieve that sort of effect, particularly when a ROM 
monitor is present and you want to return to it, or whatever other 
(configurable) behaviour. But for much later (beyond 2.1 probably in 
practice).

Jifl
-- 
eCosCentric    http://www.eCosCentric.com/    The eCos and RedBoot experts
--[ "You can complain because roses have thorns, or you ]--
--[  can rejoice because thorns have roses." -Lincoln   ]-- Opinions==mine



More information about the Ecos-maintainers mailing list