home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / cplus / 13670 < prev    next >
Encoding:
Text File  |  1992-09-14  |  1.6 KB  |  39 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!spool.mu.edu!sol.ctr.columbia.edu!ira.uka.de!slsvaat!us-es.sel.de!dada
  3. From: dada@us-es.sel.de (David Ashley Davies)
  4. Subject: Re: Virtual methods
  5. Message-ID: <1992Sep15.095940.13974@us-es.sel.de>
  6. Keywords: interrupt handler virtual methods
  7. Sender: news@us-es.sel.de
  8. Organization: SEL-Alcatel LTS Dept. US/ES
  9. References:  <#7vnafk.feustel@netcom.com> <1992Sep14.145950.7661@us-es.sel.de>
  10. Date: Tue, 15 Sep 92 09:59:40 GMT
  11. Lines: 26
  12.  
  13. In article <1992Sep14.145950.7661@us-es.sel.de>, brendan@us-es.sel.de (Dalton) writes:
  14. |> feustel@netcom.com (David Feustel) writes:
  15. |> 
  16. |> |> Coplien's book "Advanced C++" makes the point that very little overhead
  17. |> |> would be incurred in most programe even if all functions were declared
  18. |> |> virtual and that some programs might even run faster than equivalent C
  19. |> |> programs using switch constructs to achieve the same effects.
  20. |> 
  21. |> This reminds me of a question which I've been meaning to ask for some
  22. |> time now. Ignoring performance issues, why would one not declare every
  23. |> method in a class virtual? What circumstances might preclude its use?
  24.  
  25. 1/ Interrupt handler.  Has to be static.
  26. (Or does anyone out there know of some wonderful o-o hardware that
  27.  gets around this problem?)
  28.  
  29. 2/ Prevent subclass override of method definition.
  30.  
  31. As far as overhead is concerned, there were reported speed improvements of
  32. 10-20% using object pascal (all virtual) and the MacApp class library against
  33. conventional case (switch) code processing the event loop.  On the other hand,
  34. the bloat in executable size was also about 20%.  Swings and roundabouts.
  35.  
  36. David.
  37. _______________
  38. David A. Davies
  39.