Article View: comp.std.c++
Article #3520Is dynamic_cast safe?
From: Lars Farm
Date: Tue, 27 Feb 1996 16:01
Date: Tue, 27 Feb 1996 16:01
22 lines
1403 bytes
1403 bytes
5.2.6 Dynamic cast [expr.dynamic.cast]
...
6 Otherwise, v shall be a pointer to or an lvalue of a polymorphic type
...
What should happen when 'v' is not a pointer to or an lvalue of a
polymorphic type? return 0? crash? throw bad_cast? undefined?
...
8 The run-time check logically executes like this:
[...] Otherwise, the run-time check fails.
If fail means undefined, why not require that it returns 0?
--
Lars Farm, lars.farm@nts.mh.se
[ 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:
<AD58B8389668E1A9@sleipner.nts.mh.se>Path:
arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamageShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage From: lars.farm@nts.mh.se (Lars Farm) Newsgroups: comp.std.c++ Subject: Is dynamic_cast safe? Date: 27 Feb 1996 16:01:15 GMT Organization: pv Approved: clamage@eng.sun.com (comp.std.c++) Message-ID: <AD58B8389668E1A9@sleipner.nts.mh.se> NNTP-Posting-Host: taumet.eng.sun.com Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Nntp-Posting-Host: sleipner.nts.mh.se X-Lines: 14 Content-Length: 503 Originator: clamage@taumet