delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/11/20:00:54

From: myknees AT aol DOT com (Myknees)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Namespaces
Lines: 43
Message-ID: <1998091123580600.TAA20493@ladder03.news.aol.com>
NNTP-Posting-Host: ladder03.news.aol.com
Date: 11 Sep 1998 23:58:05 GMT
References: <35F8414B DOT C559D94D AT unb DOT ca>
Organization: AOL http://www.aol.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <35F8414B DOT C559D94D AT unb DOT ca>, Endlisnis <s257m AT unb DOT ca> writes:

>> I think we'll see a lot of C++ stuff migrating over to C such as try and
>> catch.  Then the problem will be how to differentiate C from C++.  Like,
>> is the goal of C to be a sort of "C++-lite" without classes?  For
>> example:  if you do a lot of low-level hardware stuff and/or need a low
>> memory footprint and low CPU usage, then use C over C++.  But then again
>> C++ compilers are fast catching up to C compilers in terms of executable
>> size and speed, so the point may come where we may have to say "why not
>> just merge C with C++" since there's so much diffusion back and forth.
>	Well, since C++ is (basically) a superset of C, that has aldready
happened. 
>I don't understand any advantages to using C over C++ other than the possible
>difference in optimization/memory footprint.  What does C have that C++
>doesn't?  [and I don't mean things like slightly different syntax]

That's true, but the two languages have markedly different aims in the way they
were designed.  C is pretty straightforward: the code you write has more of a
one-to-one correspondence to what goes on in memory.  And C was made with that
in mind.

C++, on the other hand, was built on different concepts.  It assumes that there
will be large bodies of code and many programmers.  So it is designed with
features for making it easy to have at least two types of programmers: the
library designers/implementers and the library users.  

Consequentially, there is not so much of a direct correspondence in C++ between
source code and machine operations.  You can say *p++, and it might not have
_anything_ to do with a pointer or incrementation.  (e.g. if p is an iterator
that's not implemented as a pointer and the postfix ++ operator has been
defined to do something else.)

I kind of get the feeling that many of the djgpp'ers (myself included) like the
directness of the C way.  I have a feeling that with the Standard Template
Library --very fast and convenient-- becoming more popular and stable, we'll
see even more people starting to use C++.  

But Stroustrup seems to support Endlisnis when he says in the 3rd ed, in the "C
and C++" section, "...good C programs tend to be C++ programs.  For example,
every program in Kernighan and Ritchie, _The C Programming Language_, is a C++
program."

--Ed (Myknees)

- Raw text -


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