This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH to remove signature support
- To: Mark Mitchell <mark@codesourcery.com>
- Subject: Re: PATCH to remove signature support
- From: Fredrik Öhrström <d92-foh@nada.kth.se>
- Date: Thu, 12 Aug 1999 10:47:05 +0200 (MET DST)
- cc: gcc@gcc.gnu.org
- Reply-To: Fredrik Öhrström <d92-foh@nada.kth.se>
On Wed, 11 Aug 1999, Mark Mitchell wrote:
> This patch removes support for `signature', a g++ extension that is
> little-used and which Jason and I agreed should go. The reduction in
> complexity elsewhere in the front-end will be a big win.
Signatures fills a similar role as interfaces in Java, but are
more advanced. A signature is in fact compiler support for the
bridge pattern. Now, this IS useful when building distributed
objects. You can bind the signatures to either an implementation or
a proxy and with the help of signatures the inheritance hierarchy can
be different in both cases.
I also like signatures because they streamline the design of an
interface.
Anyway, I was trying to add inheritance to signatures, but I can just
as well stop that work now... :-)
So now I have a question about efficiency:
It seems to me that virtual abstract base classes is needed if you
want to separate the implementation classes from the interfaces
without the help of signatures.
struct AlfaInterface
{
virtual int a () = 0;
};
struct BetaInterface : public virtual AlfaInterface
{
virtual int b () = 0;
};
struct AlfaImpl : public virtual AlfaInterface
{
int a () { return 0; }
};
struct BetaImpl : public virtual BetaInterface,
public AlfaImpl
{
int q;
BetaImpl (int a) : q(a) {}
int b () { return q; }
};
int main ()
{
BetaInterface *b = new BetaImpl(2);
return b->b();
}
What is the efficiency of the code when using empty abstract virtual
base classes? I looked at the assembler output and it seems have its
share of thunks. Is it possible to make the vtable smarter since
there is no data in the interfaces?
I can understand that not many people uses signatures since it is gcc
extension, but is there nothing in upcoming C++ standards that sort
of resembles interfaces or signatures?
//Fredrik