Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Ian Collins Newsgroups: comp.lang.c++ Subject: Re: Generally, are the programs written by C++ slower than written by C 10% ? Date: Sat, 03 Sep 2011 20:53:25 +1200 Lines: 28 Message-ID: <9ce886FsstU1@mid.individual.net> References: <4e61c07d$0$3061$7b1e8fa0@news.nbl.fi> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net kw4Ty3lVqBcDq20gE1FLcQ/Yk6gxbGNBlI/JZSNT7GoSoGqEpM Cancel-Lock: sha1:Tq8xP8mlB/qIxbAGAfm54nwFC6U= User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.9.2.9) Gecko/20101021 Lightning/1.0b2 Thunderbird/3.1.4 In-Reply-To: Xref: x330-a1.tempe.blueboxinc.net comp.lang.c++:9688 On 09/ 3/11 08:45 PM, BGB wrote: > On 9/2/2011 10:51 PM, Juha Nieminen wrote: >> KaiWen wrote: >>> 2. In runtime, the speed of the program written by C++ is<= the same >>> program written by C >> >> Actually many equivalent constructs in C and C++ are such that it's >> the exact opposite: C++ is significantly faster than C. >> >> Just two simple examples are qsort() vs. std::sort() , and strlen() >> vs std::string::length(). Especially in the first case it's precisely >> the language features that help the compiler make a faster executable. > > this again, comes down to coding practices... > > > also, just how many people really use "qsort()" anyways?... > IME, it is more often one of those largely forgotten functions (it is > there, but more often people write out their own sort logic manually). > > (actually, it seems to be fairly common practice in C land for people to > largely ignore much of the standard library, and to write their own > logic for doing things). That says it all really, C++ programmers don't have to. -- Ian Collins