This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Using C++ in GCC is OK
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Earnshaw <rearnsha at arm dot com>
- Cc: Mark Mitchell <mark at codesourcery dot com>, Richard Guenther <richard dot guenther at gmail dot com>, Robert Dewar <dewar at adacore dot com>, ????????? <chiheng dot xu at gmail dot com>, GCC <gcc at gcc dot gnu dot org>
- Date: Wed, 2 Jun 2010 20:09:09 +0200
- Subject: Re: Using C++ in GCC is OK
- References: <4C030228.8020201@codesourcery.com> <AANLkTimzVEXsE4vOZJuegnHFu-pVyNdKImcasoSX_ZDc@mail.gmail.com> <4C039253.5080406@adacore.com> <AANLkTikp-gTh4bCpAFYWhU7fR9tBTxOP6mQp9TAfideB@mail.gmail.com> <4C03EB8D.6010307@codesourcery.com> <1275499045.9742.20.camel@e102346-lin.cambridge.arm.com> <20100602175005.GE26878@sunsite.ms.mff.cuni.cz> <1275501131.9742.28.camel@e102346-lin.cambridge.arm.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Wed, Jun 02, 2010 at 06:52:11PM +0100, Richard Earnshaw wrote:
> > Currently targetm is a struct with function pointers, so calling
> > targetm.hook_xyz ();
> > means reading a pointer from &targetm + off, then calling it.
> > If you make it a class with virtual functions and targetm
> > would be an object of that class, then
> > targetm.hook_xyz ();
> > call means reading pointer from &targetm (the vtable pointer), followed
> > by reading the function pointer from the virtual table, then calling it.
> > One extra memory read for hook call.
>
> A missing virtual hook would be a build failure, rather than a runtime
> error. So the advantage is easier maintenance.
All the target hooks have defaults, so what means a missing virtual hook?
And, how often are target hooks changed compared to how often target hooks
are called during compilation?
Jakub