Path: utzoo!news-server.csri.toronto.edu!rutgers!uwm.edu!wuarchive!sdd.hp.com!elroy.jpl.nasa.gov!decwrl!infopiz!lupine!rfg From: rfg@NCD.COM (Ron Guilmette) Newsgroups: comp.std.c++ Subject: Re: type/member tags (was Re: asking an object for its type) Message-ID: <4332@lupine.NCD.COM> Date: 10 Mar 91 03:20:58 GMT References: <70877@microsoft.UUCP> <10721@dog.ee.lbl.gov> <11792@pasteur.Berkeley.EDU> Organization: Network Computing Devices, Inc., Mt. View, CA Lines: 22 In article <11792@pasteur.Berkeley.EDU> jbuck@galileo.berkeley.edu (Joe Buck) writes: +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... + +False. Several reasons: ... +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. And this happens quite often! Addresses of vtables CANNOT BE USED as globally unique class identifiers. Period. -- // Ron Guilmette - C++ Entomologist // Internet: rfg@ncd.com uucp: ...uunet!lupine!rfg // New motto: If it ain't broke, try using a bigger hammer.