Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!pasteur!helios.ee.lbl.gov!nosc!cod!mball From: mball@cod.NOSC.MIL (Michael S. Ball) Newsgroups: comp.lang.c++ Subject: Re: Virtual destructors Keywords: virtual destructor portability Message-ID: <1431@cod.NOSC.MIL> Date: 2 Mar 89 22:25:02 GMT References: <551@hrc63.co.uk> <1430@cod.NOSC.MIL> <101@riunite.ACA.MCC.COM> Reply-To: mball@cod.nosc.mil.UUCP (Michael S. Ball) Organization: Naval Ocean Systems Center, San Diego Lines: 31 In article <101@riunite.ACA.MCC.COM> rfg@riunite.UUCP (Ron Guilmette) writes: >In article <1430@cod.NOSC.MIL> mball@cod.nosc.mil.UUCP (Michael S. Ball) writes: >>In article <551@hrc63.co.uk> pj@hrc63.co.uk (Mr P Johnson "Baddow") writes: >>>In Oregon C++ (for Suns) v 1.1, it is possible to declare the base destructor >>>as virtual. This then ensures that the appropriate destructor is called for >>>any derived classes provided that the _derived_class_has_a_destructor_. If >>>the derived class has no explicit destructor then any member destructors will >>>not be called (rather than being called implicitly as they would be normally). >> >>I believe this is a bug. > >I'm not sure what the "correct" semantics are myself, but I don't think it >is a bug. It is not a question of whether virtual destructors are allowed. They are, and should behave like all other virtual functions, which is to say that references to them will normally go through the virtual table. The problem, which is what I said was a bug, is that the destructors generated by the compiler were NOT being treated as virtual even though the base class destructor WAS virtual. Since a user destructor for the derived class will be virtual, it seems only logical that the compiler-generated one will be as well. It is not being so treated in the current version Oregon C++. I have no idea what G++ does in that situation, and the data you included does not cover this case. Mike Ball TauMetric Corporation 1094 Cudahy Pl. Ste 302 San Diego, CA 92110 (619)275-6381 mball@cod.nosc.mil