Article View: comp.std.c++
Article #2544Re: Virtual functions and destructors
From: Dick Menninger
Date: Mon, 13 Nov 1995 18:11
Date: Mon, 13 Nov 1995 18:11
61 lines
2567 bytes
2567 bytes
> ==========John Max Skaller, 11/10/95========== > > > martelli@cadlab.it (Alex Martelli) wrote: > > > >parker@WPI.EDU (Chris Parker) writes: > > ... > >If that subclass is destroyed through a pointer to an ancestor whose > >dtor isn't virtual, undefined behaviour (violation of a "shall"). > > > No no! Undefined behaviour is NOT a violation. > > Conformance applies to COMPILERS. When behaviour > is not defined, the compiler can produce code that > does anything, because there is no requirement > to satisfy. > > So it's exactly the opposite of what you said: > where behaviour is undefined is the one place > it is IMPOSSIBLE for a "shall" to be violated, > because there isn't one :-) > Actually, "undefined behavior" is a precisely defined term in the WP, and not just a vague common term. The meanings are constrained (1.3) by text that starts "Permissible undefined behavior ranges from" and then give three categories of behavior that are permissible. The compiler can ignore it and let the chips fall where they may. The compiler can establish wierd responses by making it part of the "environment" by explicitly documenting that (a warning label if you will). The compiler can terminate translation or execution with a warning message. In general, the application of this term to situations by the committee is based on the situation being potentially too hard to diagnose in some of its manifestations. There is a commonsense "shall" where these situations are concerned. The programmer shall avoid these situations like the plague because the compiler will invariably do the first of the three permissible behaviors and not help detect it (Murphy's Law is they do not detect your case, whatever it is). Good Day Dick Dick.Menninger@DaytonOH.ATTGIS.COM --- [ 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:
<DHzqpv.HF8@falcon.daytonoh.attgis.com>Path:
arc1-ca.pugleaf.net!128.32.155.1!mattReferences:
<480ksh$9lb@oznet03.ozemail.com.au>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!128.32.155.1!matt From: Dick Menninger <Dick.Menninger@daytonoh.attgis.com> Newsgroups: comp.std.c++ Subject: Re: Virtual functions and destructors Date: 13 Nov 1995 18:11:08 GMT Organization: AT&T Global Information Solutions Approved: matt@physics2.Berkeley.EDU (Matt Austern) Message-ID: <DHzqpv.HF8@falcon.daytonoh.attgis.com> References: <480ksh$9lb@oznet03.ozemail.com.au> Reply-To: mennid <Dick.Menninger@daytonoh.attgis.com> NNTP-Posting-Host: physics2.berkeley.edu