🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: dynamic_cast

#4086
From: John E. Potter
Date: Wed, 17 Apr 1996 17:41
31 lines
2113 bytes
Jason Merrill (jason@cygnus.com) wrote:
: >>>>> John E Potter <jpotter@falcon.lhup.edu> writes:

: > In trying to trace a perceived bug in g++2.7.2 to the DWP, I
: > found that it seems vague.  I have paraphrased to save space.  If
: > I messed it up, say so.  In the following, assume B is a polymorphic
: > base of D and that A is unrelated.

: I think the WP is pretty clear that a null pointer should not be adjusted
: or dereferenced.  I have fixed this in g++ for 2.8.

That was also my first impression; however, the more I read it the less
clear it became.  The two options were: (1) Make a run time test for
null pointer in all cases like delete.  (2) Let the user beware of null
pointers like all other cases.  Not sure what the committee intended.

Did you also change it to allow dynamic_cast<Some*>(0)?  I thought that
that g++ error was correct after several reads.

What about the dynamic_cast<Unrelated*>(SomePolymorphic*)?  Is that a
compile time error or a run time test which always fails?

Thanks,
John
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your 
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu 
]
Technical Details
Message-ID: <4l2lls$79m@jake.esu.edu>
Path: arc1-ca.pugleaf.net!fido.asd.sgi.com!austern
References: <4kmdqk$kjk@jake.esu.edu> <u9pw9askr1.fsf@yorick.cygnus.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!fido.asd.sgi.com!austern
From: jpotter@falcon.lhup.edu (John E. Potter)
Newsgroups: comp.std.c++
Subject: Re: dynamic_cast
Date: 17 Apr 1996 10:41:42 PDT
Organization: East Stroudsburg University, Pennsylvania
Approved: austern@isolde.mti.sgi.com
Message-ID: <4l2lls$79m@jake.esu.edu>
References: <4kmdqk$kjk@jake.esu.edu> <u9pw9askr1.fsf@yorick.cygnus.com>
NNTP-Posting-Host: isolde.mti.sgi.com
X-Original-Date: 17 Apr 1996 11:46:04 GMT
X-Newsreader: TIN [version 1.2 PL2]
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBVAwUBMXUtV0y4NqrwXLNJAQGR9gH/YO0uSKAW0Itp6xR6Q5r9Mwn09zBPiDDY
 moQj7FPZabIyJC1szO/oa/y9RUJOxkyeRmEqAcKGGxQLu4h+YxAEyA==
 =NNIY
Originator: austern@isolde.mti.sgi.com