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