🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: rec.games.programmer
Article #1975

Re: Should I learn C or C++ first?

#1975
From: Duncan Napier
Date: Tue, 15 Aug 1995 20:56
47 lines
2611 bytes
In article <DDB2yq.Cv2@research.att.com> bs@research.att.com (Bjarne Stroustrup <9758-26353> 0112760) writes:
>
>douvilld@Cognos.COM (Derek Douville) writes:
[ lots of stuff deleted]
>
> > Also,  fo straight-forward programs that are NOT complex,
> > C++ has no place replacing C.  
[more stuff deleted]
>
>I disagree. Most programs are written faster, safer, cleaner, and as
>efficiently in run-time and space in the C subset of C++ than in a style
>that takes advantage of non-C++ features of C. 
>
> > If we want to talk speed,  C++ is slower than hell with so much over-
> > head,  all because of the iostream.h header,  which for a small pro-
> > gram pulls in thousands of lines of code.
>
>I have measured C++ and C extensively. C++ code is not inherently slower
>or larger than C code. It can appear to be when comparing a C++ and a C
>compiler with different code generation strategies or different optimization
>settings, but there is no inherent differences. I have also seen examples
>where the code generated by a C++ compiler outperformed the code generated
>by a C compiler.
[deleted]

This is topic that has been debated here before with religous zeal and
 theological intensity. In scientific circles, where FORTRAN still dominates,  
 C++ code compiled with current compilers has acquired a reputation for
 slowness. The evidence presented is often anecdotal (as stated above).
 I have seen benchmarks for scientific calculations in

"Is C++ Fast Enough for Scientific Computing?" by Scott W. Haney, in Computers
 in Physics, V.8, No. 6, Nov/Dec 1994, pp.690-694. 

 in which the performance of C++ code is measured to be less than inspiring,
 relative to FORTRAN and C on 6 different platforms, (based on serial
 calculations with arrays). The lesson seems to be that one has to be wary of 

(i) inappropriate compiler comparisons 
(ii) poor implementation (eg. poor class design)
(iii) poor compiler optimization of specific language features, such as
 pointer aliases and overloaded operators.
 
when making such comparisons. 

				Duncan Napier.
 
Technical Details
Message-ID: <40r1lo$c2j@nntp.ucs.ubc.ca>
Path: arc1-ca.pugleaf.net!unixg.ubc.ca!napier
References: <40m1bc$ffk@news-2.csn.net> <40mqib$msc@wormhole.cognos.com> <DDB2yq.Cv2@research.att.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!unixg.ubc.ca!napier
From: napier@theory.chem.ubc.ca (Duncan Napier)
Newsgroups: rec.games.programmer,comp.lang.c++,comp.sys.super
Subject: Re: Should I learn C or C++ first?
Date: 15 Aug 1995 20:56:24 GMT
Organization: University of British Columbia, Vancouver, B.C., Canada
Distribution: inet
Message-ID: <40r1lo$c2j@nntp.ucs.ubc.ca>
References: <40m1bc$ffk@news-2.csn.net> <40mqib$msc@wormhole.cognos.com> <DDB2yq.Cv2@research.att.com>
NNTP-Posting-Host: grouse.chem.ubc.ca