delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/06/19:53:12

Date: Sat, 6 Dec 1997 16:49:11 -0800 (PST)
Message-Id: <199712070049.QAA20374@adit.ap.net>
Mime-Version: 1.0
To: g DOT reed AT clear DOT net DOT nz (Glenn Reed), djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: Which is best? C or C++ ???

At 09:15  12/6/1997 GMT, Glenn Reed wrote:
>Hi,
>
>Can someone break through all the hype for me.  Which is the better
>language C or C++?  I suppose I should qualify it.
This has been the subject of infinite holy wars. Nearly everyone prefers one
over the other, and will tell you how much better their favorite is. It is
mainly a philosophical issue as well. (Note that I happen to be a C person
in general, so read this post with a grain of salt, since my knowledge of
C++ things is less than definitive. :)
>1.  Some people say that C is more efficient than C++ but does this
>still matter with the faster computers, eg 486s, Pentiums.  How much
>more inefficient is it?
Efficiency is efficiency, regardless of how fast it goes. The main source of
inefficiency in C++ that's usually talked about is that calling a function
results in a table lookup to find exactly which method is appropriate. This
is probably only a few cycles, however. In the case of DJGPP (see? This post
isn't totally off-topic), many people have said that GCC optimizes C better
than C++, so that could affect things.
[avoiding philosophical questions 2 and 3]
>4.  Most code (particularly with the DJGPP projects) seems to be
>written in C these days, and fewer stuff written in C++.  Is this
>because of the GPL license stuff or because it is harder and more
>difficult (and hence takes a lot more time) to write in C++.
I can only guess that it's due to people's personal preference. The
copyright issue is not much of a problem, since the only parts of the C++
library that is GPL'ed is `libg++', which consists only (IIRC) of GNU's
extensions. However, the C side of GCC has been around much longer, and
therefore is more stable. G++ currently has what I'm told is a strange
system for dealing with templates. Also, some C++ features such as
exceptions and namespaces are not fully implemented and cause compiler
crashes. I've also seen more people finding compiler bugs with C++ than C.
But you really should make your own decision. Find out more about the
structure of each language, and decide which you think would work better for
you.

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019