🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Add dynamic_cast<type_info&>

#1922
From: Fergus Henderson
Date: Thu, 07 Sep 1995 18:21
33 lines
2074 bytes
"Etay Bogner" <Etay_Bogner@mail.stil.scitex.com> writes:

>[...] why not have a dynamic_cast<type_info&) ?
>
>So one can pass a type_info, which was NOT obtained via typeid(), to a
>function which will, among others, use dynamic_cast ...

I don't understand your suggestion.  I suspect that it is a half-baked
idea which when analyzed will turn out to not make any sense.  But if
you are willing to explain it, I'm willing to explore it further.

The syntax `dynamic_cast<type_info&>(foo)' already has a defined
meaning.  Were you proposing to change this?  If so, what semantics
do you propose, and how do they differ from the existing semantics?

Or were you proposing to define semantics for `dynamic_cast<bar>(foo)'
in the case where `bar' is type `type_info'?  (In that case, shouldn't
you have said dynamic_cast<const type_info&>?  Why require the
type_info to be a modifiable lvalue?)  If you were proposing to define
semantics for `dynamic_cast<bar>(foo)', what would be the static type
of that expression?  What would be the behaviour at run-time?

-- 
Fergus Henderson             |  #define x t=a[i],a[i]=a[m],a[m]=t
                             |  char a[]=" 12345678";main(m,i,j,t){for(i=m;i<
fjh@cs.mu.oz.au              |  9;x,i++)for(x,j=m;--j?(t=a[m-j]-a[m])-j&&t+j:
http://www.cs.mu.oz.au/~fjh  |  main(m+1)*0;);m-9||puts(a+1);} /* 8 queens */

---
[ 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: <MATT.95Sep7112147@physics10.Berkeley.EDU>
Path: arc1-ca.pugleaf.net!128.32.155.1!matt
References: <9508048102.AA810263857@mail.stil.scitex.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!128.32.155.1!matt
From: fjh@munta.cs.mu.OZ.AU (Fergus Henderson)
Newsgroups: comp.std.c++
Subject: Re: Add dynamic_cast<type_info&>
Date: 07 Sep 1995 18:21:47 GMT
Organization: Computer Science, University of Melbourne, Australia
Approved: matt@physics10.Berkeley.EDU (Matt Austern)
Message-ID: <MATT.95Sep7112147@physics10.Berkeley.EDU>
References: <9508048102.AA810263857@mail.stil.scitex.com>
NNTP-Posting-Host: physics10.berkeley.edu