home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / c / 19499 < prev    next >
Encoding:
Internet Message Format  |  1993-01-10  |  2.0 KB

  1. Xref: sparky comp.lang.c:19499 comp.lang.c++:18901
  2. Path: sparky!uunet!math.fu-berlin.de!uni-paderborn.de!urmel.informatik.rwth-aachen.de!tabaqui!dak
  3. From: dak@tabaqui.informatik.rwth-aachen.de (David Kastrup)
  4. Newsgroups: comp.lang.c,comp.lang.c++
  5. Subject: Re: C/C++ Speed
  6. Date: 10 Jan 93 20:03:59 GMT
  7. Organization: Rechnerbetrieb Informatik - RWTH Aachen
  8. Lines: 36
  9. Distribution: usa
  10. Message-ID: <dak.726696239@tabaqui>
  11. References: <1ipsk5INNf5m@aludra.usc.edu>
  12. NNTP-Posting-Host: tabaqui.informatik.rwth-aachen.de
  13.  
  14. dliao@aludra.usc.edu (David Liao) writes:
  15.  
  16. >    Two programmers are writing the same program but with different
  17. >languages which are C and C++.  These two programmers are experts in 
  18. >their own programming language.  Hmm... which program will run faster
  19. >than the other?
  20.  
  21. >    I've heard that the execution speed of C++ tends to be slower
  22. >than C.  I know that C++ can make the life of programmer easier, but
  23. >I just want to know if the C program will run faster than the C++ program.
  24.  
  25. >    I also heard the size of C++ program is generally bigger than C.
  26. >I am a C programmer trying to learn C++.  So, don't blame me if I have 
  27. >created any misconception about C++.
  28.  
  29. For one minor detail: including printf/scanf can include more code than
  30. is actually used. An intelligent C++ linker will only get that parts
  31. of the stream library REALLY needed.
  32.  
  33. Then comparing C++ to C in speed will usually result in C++ being very
  34. slightly slower, IFF the same job with the same methods is done in both
  35. languages. But that's just it.
  36.  
  37. When you are using C++, you are much more likely to be able to reuse
  38. efficient shrinkwrapped classes somebody else made for something
  39. different or just as part of a class library.
  40.  
  41. Furthermore, having the possibility to encapsulate will make you
  42. bolder in choosing your algorithms, in as far that suitably choosing
  43. appropriate class mechanisms will allow you to cleaner partitioning
  44. into subproblems.
  45.  
  46. Complete projects in C++ tend to be more efficient than C projects,
  47. just as complete projects in C tend to be more efficient than
  48. Assembler projects...
  49.  
  50.