Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Why do people still use C instead of C++ ?

Reply
Thread Tools

Why do people still use C instead of C++ ?

 
 
Lawand
Guest
Posts: n/a
 
      12-25-2008
Hello.

AFAIKnew, people used to choose C over C++ as a programming language
for their projects because it posses better performance and execution
speed, but after I read this article <a herf="http://unthought.net/c++/
c_vs_c++.htmle">(C versus C++)</a> I noticed that C++ beats C in
benchmarking so, why does any programmer on earth still use/learn/
teach C instead of C++?

Shouldn't C++ have replaced C? even when developing an OS kernel or
such sensitive software.
 
Reply With Quote
 
 
 
 
Ian Collins
Guest
Posts: n/a
 
      12-25-2008
Lawand wrote:
> Hello.
>
> AFAIKnew, people used to choose C over C++ as a programming language
> for their projects because it posses better performance and execution
> speed, but after I read this article <a herf="http://unthought.net/c++/
> c_vs_c++.htmle">(C versus C++)</a> I noticed that C++ beats C in
> benchmarking so, why does any programmer on earth still use/learn/
> teach C instead of C++?
>
> Shouldn't C++ have replaced C? even when developing an OS kernel or
> such sensitive software.


Have you ever tried to find a C++ compiler for a PIC?

--
Ian Collins
 
Reply With Quote
 
 
 
 
Rolf Magnus
Guest
Posts: n/a
 
      12-26-2008
Ian Collins wrote:

> Lawand wrote:
>> Hello.
>>
>> AFAIKnew, people used to choose C over C++ as a programming language
>> for their projects because it posses better performance and execution
>> speed, but after I read this article <a herf="http://unthought.net/c++/
>> c_vs_c++.htmle">(C versus C++)</a> I noticed that C++ beats C in
>> benchmarking so, why does any programmer on earth still use/learn/
>> teach C instead of C++?
>>
>> Shouldn't C++ have replaced C? even when developing an OS kernel or
>> such sensitive software.

>
> Have you ever tried to find a C++ compiler for a PIC?


Not sure about PIC, but there is one for AVR.

 
Reply With Quote
 
paulkp@mbnet.fi
Guest
Posts: n/a
 
      12-26-2008
On 26 joulu, 00:11, Lawand <(E-Mail Removed)> wrote:
> benchmarking so, why does any programmer on earth still use/learn/
> teach C instead of C++?


For many reasons. Usually people have irrational reasons for
using thing X. That's how people are. Even I was like that and
I'm a genius.
 
Reply With Quote
 
Lawand
Guest
Posts: n/a
 
      12-26-2008
On Dec 26, 1:40*am, Ian Collins <(E-Mail Removed)> wrote:
> Lawand wrote:
> > Hello.

>
> > AFAIKnew, people used to choose C over C++ as a programming language
> > for their projects because it posses better performance and execution
> > speed, but after I read this article <a herf="http://unthought.net/c++/
> > c_vs_c++.htmle">(C versus C++)</a> I noticed that C++ beats C in
> > benchmarking so, why does any programmer on earth still use/learn/
> > teach C instead of C++?

>
> > Shouldn't C++ have replaced C? even when developing an OS kernel or
> > such sensitive software.

>
> Have you ever tried to find a C++ compiler for a PIC?
>
> --
> Ian Collins


That's something I haven't thought of, but let's say there isn't, in
that case, is the lack of C++ compilers for micro controllers means
that there can't be, or means that there shouldn't be.
Or maybe they didn't design one because it's complex.

Anyway, it's not what I am wondering about, what I don't know the
reason of, is writing code (for CPUs, not micro controllers) such as
OS kernels in C instead of C++.
I mean, why bother using C where there exist a more programmer
efficient and faster counterpart, the C++ ?
 
Reply With Quote
 
maverik
Guest
Posts: n/a
 
      12-26-2008
On Dec 26, 1:11*am, Lawand <(E-Mail Removed)> wrote:
> Hello.
>
> AFAIKnew, people used to choose C over C++ as a programming language
> for their projects because it posses better performance and execution
> speed, but after I read this article <a herf="http://unthought.net/c++/
> c_vs_c++.htmle">(C versus C++)</a> I noticed that C++ beats C in
> benchmarking so, why does any programmer on earth still use/learn/
> teach C instead of C++?
>
> Shouldn't C++ have replaced C? even when developing an OS kernel or
> such sensitive software.


Probably, it's better to use a tool that is better suited to your
task. So it depends.

For example, you want to eat a plate of soup. You have 2 ways: you can
use a spoon or an excavator shovel. It is well known that shovel more
powerful tool for rake and beats the spoon. So, should you use
excavator shovel? Probably not. And why? Because, a spoon can solve
this problem more efficiently that the excavator shovel.
 
Reply With Quote
 
jason.cipriani@gmail.com
Guest
Posts: n/a
 
      12-26-2008
On Dec 25, 5:11*pm, Lawand <(E-Mail Removed)> wrote:
> Hello.
>
> AFAIKnew, people used to choose C over C++ as a programming language
> for their projects because it posses better performance and execution
> speed, but after I read this article <a herf="http://unthought.net/c++/
> c_vs_c++.htmle">(C versus C++)</a> I noticed that C++ beats C in
> benchmarking so, why does any programmer on earth still use/learn/
> teach C instead of C++?


You must not have read the article, or you're here trolling. It was an
RB-tree implemented in C++ vs. a hash table implemented in C. At the
bottom of the article, it clearly states:

"But this benchmark is no good for the purpose of the "C versus C++"
argument - it's two completely different approaches that yield
completely different results, for reasons that have nothing to do with
the languages used."

There's not, actually, a difference in performance between the two.
They're both compiled to native code, frequently by a compiler that
handles both languages at once, using the same logic for compilation.
Check out the code your compiler generates. A performance difference
between the two languages wouldn't actually make any sense. Any byte
code you produce from C++ can be produced almost identically with C,
except it will take you a heck of a lot longer to express it in C. The
only big difference in "performance" is your algorithms, as shown in
the article.

I guess you missed that part?


> Shouldn't C++ have replaced C? even when developing an OS kernel or
> such sensitive software.


You're welcome to port the existing Linux kernel (for example), to C+
+. While you're working on it, you can reflect on why nobody else has
done it yet.

Most of the time the reasons are that you are maintaining code written
in C or you are on a platform that nobody has bothered to write a C++
compiler for (e.g. PIC). A lot of programmers raised on C will stick
to C because it's what they know, with logic like "well if you're not
going to use the features of C++, you might as well use C". An
experienced C programmer has techniques that he's comfortable with and
simply doesn't see a need to switch. I guess that's reasonable, who
knows (or cares)?

C++ also took a bit of time to become accepted because early (e.g. mid
90's) compilers were strange and quirky. This also probably left a bad
taste in the mouth of those who attempted to learn it at the time.
Most C++ compilers are mature enough now that it's no longer an issue.


HTH, and next time read the article.
Jason
 
Reply With Quote
 
jason.cipriani@gmail.com
Guest
Posts: n/a
 
      12-26-2008
On Dec 26, 11:37*am, (E-Mail Removed) (blargg) wrote:
> maverik wrote:
> > On Dec 26, 1:11=A0am, Lawand <(E-Mail Removed)> wrote:
> > > Hello.

>
> > > AFAIKnew, people used to choose C over C++ as a programming language
> > > for their projects because it posses better performance and execution
> > > speed, but after I read this article <a herf=3D"http://unthought.net/c++/
> > > c_vs_c++.htmle">(C versus C++)</a> I noticed that C++ beats C in
> > > benchmarking so, why does any programmer on earth still use/learn/
> > > teach C instead of C++?

>
> > > Shouldn't C++ have replaced C? even when developing an OS kernel or
> > > such sensitive software.

>
> > Probably, it's better to use a tool that is better suited to your
> > task. So it depends.

>
> > For example, you want to eat a plate of soup. You have 2 ways: you can
> > use a spoon or an excavator shovel. It is well known that shovel more
> > powerful tool for rake and beats the spoon. So, should you use
> > excavator shovel? Probably not. And why? Because, a spoon can solve
> > this problem more efficiently that the excavator shovel.

>
> But let's say you regularly eat a plate of soup at a place where, for some
> odd reason, they don't provide utensils. You also sometimes do shoveling
> when you're out. You'd bring a spoon and the excavator shovel, and use the
> spoon for the soup. C++ gives you both, and you don't have to use anything
> more than the spoon when metaphorically eating soup. You always have the
> option of using a more fancy spoon, also part of C++, building your own
> spoon, or (mis)using the shovel. The choice is yours. So why would C++ be
> ill-suited in a situation where C is suited?


This is a really silly analogy that shouldn't have been made in the
first place. Not quite sure why programmers are so keen on ridiculous
analogies all the time. It's not even necessary, and doesn't make all
that much sense. "C++ gives you both a spoon AND a shovel but C only
gives you a spoon OR a shovel" isn't really a compelling statement
of... anything at all. Sorry.

Mentioning the word "efficient", in the context of performance, is
also irrelevant. The languages are the same and the article does not
actually attempt to show a "performance" difference between the two
(go read it).

The article does explain that C is more verbose for certain tasks. The
compiled code is not going to differ that much between the two. You
can express the same programs with both, you just have to type more
with C sometimes.

HTH,
Jason
 
Reply With Quote
 
Lawand
Guest
Posts: n/a
 
      12-26-2008
On Dec 26, 6:43*pm, "(E-Mail Removed)"
<(E-Mail Removed)> wrote:
> On Dec 25, 5:11*pm, Lawand <(E-Mail Removed)> wrote:
>
> > Hello.

>
> > AFAIKnew, people used to choose C over C++ as a programming language
> > for their projects because it posses better performance and execution
> > speed, but after I read this article <a herf="http://unthought.net/c++/
> > c_vs_c++.htmle">(C versus C++)</a> I noticed that C++ beats C in
> > benchmarking so, why does any programmer on earth still use/learn/
> > teach C instead of C++?

>
> You must not have read the article, or you're here trolling. It was an
> RB-tree implemented in C++ vs. a hash table implemented in C. At the
> bottom of the article, it clearly states:
>
> "But this benchmark is no good for the purpose of the "C versus C++"
> argument - it's two completely different approaches that yield
> completely different results, for reasons that have nothing to do with
> the languages used."
>
> There's not, actually, a difference in performance between the two.
> They're both compiled to native code, frequently by a compiler that
> handles both languages at once, using the same logic for compilation.
> Check out the code your compiler generates. A performance difference
> between the two languages wouldn't actually make any sense. Any byte
> code you produce from C++ can be produced almost identically with C,
> except it will take you a heck of a lot longer to express it in C. The
> only big difference in "performance" is your algorithms, as shown in
> the article.
>
> I guess you missed that part?
>
> > Shouldn't C++ have replaced C? even when developing an OS kernel or
> > such sensitive software.

>
> You're welcome to port the existing Linux kernel (for example), to C+
> +. While you're working on it, you can reflect on why nobody else has
> done it yet.
>
> Most of the time the reasons are that you are maintaining code written
> in C or you are on a platform that nobody has bothered to write a C++
> compiler for (e.g. PIC). A lot of programmers raised on C will stick
> to C because it's what they know, with logic like "well if you're not
> going to use the features of C++, you might as well use C". An
> experienced C programmer has techniques that he's comfortable with and
> simply doesn't see a need to switch. I guess that's reasonable, who
> knows (or cares)?
>
> C++ also took a bit of time to become accepted because early (e.g. mid
> 90's) compilers were strange and quirky. This also probably left a bad
> taste in the mouth of those who attempted to learn it at the time.
> Most C++ compilers are mature enough now that it's no longer an issue.
>
> HTH, and next time read the article.
> Jason


Calm down

Now, are you saying that, as a conclusion, C++ is better than C
(because there's no difference in performance, yet C++ has more
features), but programmers still use C just because they're used to?

And in that case, all newbies should be advised to learn C++, right?
 
Reply With Quote
 
Rui Maciel
Guest
Posts: n/a
 
      12-26-2008
Lawand wrote:

> Calm down


Trolls don't usually make people get calmer.


> Now, are you saying that, as a conclusion, C++ is better than C
> (because there's no difference in performance, yet C++ has more
> features), but programmers still use C just because they're used to?


You are putting words into jason's mouth. You failed to read the article and jason pointed out that even the article clearly stated that their benchmarks could not be used to compare the languages in those silly and pointless "language A Vs language B" discussions, which was what you promptly did.

Moreover, C and C++ are two different languages that scratch different itches. The only person that keeps forcing the "language A is better than language B" conclusion is, well... you.


Rui Maciel
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Do people still use a shutter release cable in digital camera age? aniramca@gmail.com Digital Photography 30 07-24-2007 04:55 AM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
why are people still using classic classes? Simon Wittber Python 16 01-14-2005 09:53 PM
Why do people still insist that the holocaust didn't occur? Fred A. Miller Digital Photography 11 02-26-2004 12:49 AM
STL: Do people still use char[] buffers? syncman C++ 4 01-20-2004 09:09 PM



Advertisments