home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / c / 20005 < prev    next >
Encoding:
Internet Message Format  |  1993-01-21  |  1.7 KB

  1. Xref: sparky comp.lang.c:20005 comp.lang.c++:19658
  2. Newsgroups: comp.lang.c,comp.lang.c++
  3. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!sun-barr!ames!kronos.arc.nasa.gov!butch!netcomsv!netcom.com!erc
  4. From: erc@netcom.com (Eric Smith)
  5. Subject: Re: C/C++ Correctness (was: Re: C/C++ Speed)
  6. Message-ID: <1993Jan21.081537.8192@netcom.com>
  7. Organization: Netcom - Online Communication Services (408 241-9760 guest)
  8. References: <1993Jan18.171841.3008@informix.com> <1jka6h$n32@agate.berkeley.edu> <1jkismINN3qq@armory.centerline.com>
  9. Date: Thu, 21 Jan 1993 08:15:37 GMT
  10. Lines: 22
  11.  
  12. In article <1jkismINN3qq@armory.centerline.com> jimf@centerline.com (Jim Frost) writes:
  13. ...
  14. >It's true that if you use C++ as a C with better type checking there
  15. >will be few runtime performance penalties.  In fact, C++ inlining
  16. >alone can overcome many performance drawbacks.
  17.  
  18. That implies that C++ has performance drawbacks to overcome, but there
  19. are none except when using specific non-C features of C++ which are easy
  20. to avoid, if avoiding them is desired.
  21.  
  22. Inlining can in fact make C++ faster than C, especially if it's the
  23. only non-C feature you use in C++.  For many C programmers, inlining
  24. alone is enough to justify the move to C++.
  25.  
  26. The way to make inlining effective is to use it carefully, and only
  27. inline the most critical speed sensitive functions.  If you inline
  28. functions that don't really need it, you pay a penalty in size of your
  29. executable program, which can also cause virtual memory paging, which
  30. can slow the whole program down and defeat the whole purpose of
  31. inlining.  But using it just for your most critical speed sensitive
  32. functions could in some cases make your program run significantly
  33. faster, depending on just how speed sensitive those functions are.
  34.