🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: dynamic_cast<T> implementation...

#2267
From: J. Kanze
Date: Fri, 20 Oct 1995 16:39
33 lines
1928 bytes
Michael McCarty (mikem@eai.com) wrote:
|> I confess I haven't read much of the draft standard and frankly I hope I never
|> have to, but I do have one question that is puzzling me:

|> How exactly is dynamic_cast<T> supposed to be implemented in the compiler?

|> The implementation of this worries me a bit.  I can't really imagine this
|> functionality having a practical implementation (i.e. without breaking a LOT of

|> code).

|> It seems to me that the only way to implement this is to attach a type
|> 'pointer' to every object instantiated, similar to virtual function pointer
|> tables.  If this is so, I strongly disagree with this implementation and, if it

|> came to pass in the standard, would strongly consider migrating back to C
|> because of it.

Dynamic_cast only works on objects with at least one virtual function.
In this case, there is already a `type pointer' attached, at least in
the common implementation.  Or what else would you call the pointer to
the virtual function tables.
-- 
James Kanze           (+33) 88 14 49 00          email: kanze@gabi-soft.fr
GABI Software, Sarl., 8 rue des Francs Bourgeois, 67000 Strasbourg, France
Conseils en informatique industrielle--
                             --Beratung in industrieller Datenverarbeitung

---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID: <467qg8$c6n@gabi.gabi-soft.fr>
Path: arc1-ca.pugleaf.net!128.32.155.1!matt
References: <9510191610.ZM21213@yosemite.eai.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!128.32.155.1!matt
From: kanze@gabi-soft.fr (J. Kanze)
Newsgroups: comp.std.c++
Subject: Re: dynamic_cast<T> implementation...
Date: 20 Oct 1995 16:39:07 GMT
Organization: GABI Software, Sarl.
Approved: matt@physics2.Berkeley.EDU (Matt Austern)
Message-ID: <467qg8$c6n@gabi.gabi-soft.fr>
References: <9510191610.ZM21213@yosemite.eai.com>
NNTP-Posting-Host: physics2.berkeley.edu