home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.std.c++
- Path: sparky!uunet!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtal
- From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
- Subject: Compiler should generate virtual destructors
- Message-ID: <1992Dec31.050150.28929@ucc.su.OZ.AU>
- Sender: news@ucc.su.OZ.AU
- Nntp-Posting-Host: extro.ucc.su.oz.au
- Organization: MAXTAL P/L C/- University Computing Centre, Sydney
- Date: Thu, 31 Dec 1992 05:01:50 GMT
- Lines: 22
-
- 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.
-
- Disadvantage: might slow down destruction a little. Can be
- fixed by the programmer explicitly declaring a non-virtual
- destructor.
-
- Any comments?
-
- --
- ;----------------------------------------------------------------------
- JOHN (MAX) SKALLER, maxtal@extro.ucc.su.oz.au
- Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
- ;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
-