🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #925

Re: type/member tags (was Re: asking an object for its type)

#925
From: Joe Buck
Date: Fri, 08 Mar 1991 19:41
24 lines
1694 bytes
In article <10721@dog.ee.lbl.gov>, beard@ux5.lbl.gov (Patrick C Beard) writes:
|> The information about what class an object is can be easily obtained by using
|> the pointer to the object's virtual function table as the class id, which
|> whill always be unique for every class.  This could be quite easy to add
|> to the language and easy to implement.  Class relationships would be easy
|> to implement by putting a link field in the vtable which points to a
|> class's super-class.

False.  Several reasons:

1). The language standard says nothing about virtual function tables.
It only specifies the effect of calling virtual functions.  A different
data structure could be used, and in some cases might be more efficient.

2).  You can't count on testing two objects for the same type by comparing
their vtbl pointers anyway.  The compiler may have had to duplicate the
vtbl; for example, because of incremental linking or because it didn't
have enough information to avoid generating the table more than once.



--
Joe Buck
jbuck@galileo.berkeley.edu	 {uunet,ucbvax}!galileo.berkeley.edu!jbuck	
Technical Details
Message-ID: <11792@pasteur.Berkeley.EDU>
Path: arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!think.com!linus!agate!ucbvax!pasteur!galileo.berkeley.edu!jbuck
References: <27C2D973.3C1B@tct.uucp> <DSOUZA.91Feb24173454@optima.cad.mcc.com> <70877@microsoft.UUCP> <10721@dog.ee.lbl.gov>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!think.com!linus!agate!ucbvax!pasteur!galileo.berkeley.edu!jbuck
From: jbuck@galileo.berkeley.edu (Joe Buck)
Newsgroups: comp.std.c++
Subject: Re: type/member tags (was Re: asking an object for its type)
Message-ID: <11792@pasteur.Berkeley.EDU>
Date: 8 Mar 91 19:41:33 GMT
References: <27C2D973.3C1B@tct.uucp> <DSOUZA.91Feb24173454@optima.cad.mcc.com> <70877@microsoft.UUCP> <10721@dog.ee.lbl.gov>
Sender: news@pasteur.Berkeley.EDU
Reply-To: jbuck@galileo.berkeley.edu (Joe Buck)
Lines: 24