home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / std / cplus / 1961 < prev    next >
Encoding:
Text File  |  1993-01-03  |  1.7 KB  |  43 lines

  1. Newsgroups: comp.std.c++
  2. Path: sparky!uunet!spool.mu.edu!umn.edu!myria.cs.umn.edu!hansen
  3. From: hansen@myria.cs.umn.edu (David Hansen)
  4. Subject: Re: Compiler should generate virtual destructors
  5. Message-ID: <1993Jan4.003054.9295@news2.cis.umn.edu>
  6. Sender: news@news2.cis.umn.edu (Usenet News Administration)
  7. Nntp-Posting-Host: myria.cs.umn.edu
  8. Organization: University of Minnesota
  9. References: <1992Dec31.050150.28929@ucc.su.OZ.AU> <C0Ayt4.263@fiu.edu>
  10. Date: Mon, 4 Jan 1993 00:30:54 GMT
  11. Lines: 30
  12.  
  13. In article <C0Ayt4.263@fiu.edu>, feathers@serss0 (Michael Feathers) writes:
  14. |> In article <1992Dec31.050150.28929@ucc.su.OZ.AU> maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
  15. |> >I would like to propose that if a class has virtual functions,
  16. |> >then any destructor generated by the compiler will be virtual
  17.                         ^^^^^^^^^^^^^^^^^^^^^^^^^
  18. |> >by default.
  19. |> >
  20. [...]
  21.  
  22. |> This would be a way in which a function within the source code would be
  23. |> virtual without the keyword 'virtual' having been used on it or a function of
  24. |> the same name in an inherited class.  That would bother me as a consistency 
  25. |> issue.
  26.  
  27. I think you misread the original post.  Only the automagically generated 
  28. destructors would be virtual by default.  If the programmer explicity
  29. defined a destructor _without_ the virtual keyword, it would not be virtual
  30. (unless _I_ misread the post  :).
  31.  
  32. |> 
  33. |> >Disadvantage: might slow down destruction a little. Can be
  34. |> >fixed by the programmer explicitly declaring a non-virtual
  35. |> >destructor.
  36. |> 
  37. |> The only way to make something explicity non-virtual would be the absence
  38. |> of the 'virtual' keyword, unless we add a new keyword <shudder>.
  39.  
  40. Again, see comment above.
  41.  
  42.                     -=Dave
  43.