home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!caen!uflorida!max.fiu.edu!serss0!feathers
- From: feathers@serss0 (Michael Feathers)
- Newsgroups: comp.std.c++
- Subject: Re: Compiler should generate virtual destructors
- Message-ID: <C0Ayt4.263@fiu.edu>
- Date: 4 Jan 93 00:03:04 GMT
- References: <1992Dec31.050150.28929@ucc.su.OZ.AU>
- Sender: news@fiu.edu (Usenet Administrator)
- Organization: Florida International University, Miami
- Lines: 30
-
- In article <1992Dec31.050150.28929@ucc.su.OZ.AU> maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
- >I would like to propose that if a class has virtual functions,
- >then any destructor generated by the compiler will be virtual
- >by default.
- >
- >(The suggestion was first read by me in a paper of Markku Sakkinen,
- >who claims it was not his idea originally either.)
- >
- >Advantages: much safer, ensures correct deletion of objects
- >by default. Removes a source of bugs. Removes the reminder
- >that its wise to do this from the FAQ.
-
- This would be a way in which a function within the source code would be
- virtual without the keyword 'virtual' having been used on it or a function of
- the same name in an inherited class. That would bother me as a consistency
- issue.
-
- >Disadvantage: might slow down destruction a little. Can be
- >fixed by the programmer explicitly declaring a non-virtual
- >destructor.
-
- The only way to make something explicity non-virtual would be the absence
- of the 'virtual' keyword, unless we add a new keyword <shudder>.
-
- If the destructor is going to be made virtual by that rule, there is no
- need to declare it virtual. But we can not make it explicitly non-virtual
- unless the virtual keyword is an option.
-
-
- Michael Feathers [feathers@fiu.edu] main () { main (); }
-