home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / std / cplus / 1938 < prev    next >
Encoding:
Text File  |  1992-12-31  |  1.2 KB  |  34 lines

  1. Newsgroups: comp.std.c++
  2. Path: sparky!uunet!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtal
  3. From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
  4. Subject: Compiler should generate virtual destructors
  5. Message-ID: <1992Dec31.050150.28929@ucc.su.OZ.AU>
  6. Sender: news@ucc.su.OZ.AU
  7. Nntp-Posting-Host: extro.ucc.su.oz.au
  8. Organization: MAXTAL P/L C/- University Computing Centre, Sydney
  9. Date: Thu, 31 Dec 1992 05:01:50 GMT
  10. Lines: 22
  11.  
  12. I would like to propose that if a class has virtual functions,
  13. then any destructor generated by the compiler will be virtual
  14. by default.
  15.  
  16. (The suggestion was first read by me in a paper of Markku Sakkinen,
  17. who claims it was not his idea originally either.)
  18.  
  19. Advantages: much safer, ensures correct deletion of objects
  20. by default.  Removes a source of bugs. Removes the reminder
  21. that its wise to do this from the FAQ.
  22.  
  23. Disadvantage: might slow down destruction a little. Can be
  24. fixed by the programmer explicitly declaring a non-virtual
  25. destructor.
  26.  
  27. Any comments?
  28.  
  29. -- 
  30. ;----------------------------------------------------------------------
  31.         JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
  32.     Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
  33. ;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
  34.