🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: rec.games.programmer
Article #1965

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

#1965
From: Derek Douville
Date: Mon, 14 Aug 1995 06:30
138 lines
6659 bytes
Is anyone with some common sense actually following this thread?  You people
have it all bass-ackwards.  First of all,  none of you obviously have read
up on the roots of C++ and how it came to be.  If you think BCPL->C->C++
is the answer,  then think again.

First of all,  you cannot fully understand or appreciate the C++ language
(or any language) unless you know something about its roots.  This is
why linguists studying english will require Latin, French, and Spanish
to name a few.  Secondly,  the original C++ "compilers" weren't compilers
at all.  Stroustrup had written the Cfront pre-compiler,  which basically
parsed the C++ and simplified it into C code.  Anything you can write in
C++ can be written in ANSI C (save implimentation dependant standards).

One cannot fully apreciate the advanced organizational features of C++
until they've programmed in C.  But this isn't just about apreciation
and history,  its about understanding the complexity of what is going
on behind the scenes.  Using operators like C++'s  'new' to allocate
memory obscures the fact that a void pointer is being returned to
pre-initialized memory.  The string class library can be broken down
into all the good old C functions,  plus added code to increase function-
ality.  Overloading operators is great,  but what do you think happens
to the C++ code when this is done?  The assembly looks the same.

With the understanding of C,  I have no doubt that one's C++ programs
will be more powerful,  and all of the features will be used more
wisely.  Also,  fo straight-forward programs that are NOT complex,
C++ has no place replacing 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.

eg.  -----------
 #include <stdio.h>

 void main()
 {
     printf("\nHello World\n");
 }
  ----------

will execute just as quickly as

 #include <iostream.h>

 void main()
 {
     cout << "\nHello World\n";
 }

 --------
but the compile time for the C++ program will be twice as long (this
is a guess).  Which makes more sense?  Further more,  if C++ is used
properly,  it is implimented in an object oriented way.  If you are
writing a quick 200 line procedural program,  it might as well be
done in C.

For those of you who think learning C++ will teach you C,  you're dead
wrong.  Not in a million years.  You actually can learn all of the C++
libraries and principals without a knowledge of C programming,  but
it's not the other way around.  The Waite Group's _Object_Oriented_
Programming_In_Turbo_C++_ by Robert Lafore states,

	You do not need to know the C language to use this book.  Many
	books on C++ assume that you already know C,  but this one does
	not.  It teaches C++ from the ground up.  If you do know C,  it
	won't hurt,  but you may be surprised at how little overlap there
	is between C and C++.

[Page xxi, Published 1991]

However, QUE's _USING_C_ by Lee Atkinson & Mark Atkinson contradicts
this by stating,

	If you have no prior experience with C programming,  we urge you
	to stop reading right now,  go back to the beginning of this book,
	work your way through it,  write lots of practice code,  and 
	master that material thoroughly.  If you do not,  you will be 
	quickly and utterly lost.

[Page 685, 1st Edition, Published 1990.  Revised in '93]

I have read both of these cover to cover.  In my opinion,  one does
not need to know C to learn C++;  the Robert Lafore wrote an ex-
cellent tutorial.  Lee Atkinson & Mark Atkinson took a different
approach in that C++ was a tool to build on C.  I disagree, also.

So,  why do I argue that C should be learned as a foundation?  Be-
cause it's fundamental.  It teaches one how the computer thinks.
Take one of those fancy string functions you get in C++ and do it
in C yourself.  You'll be amazed at the skills you require.  In
addition,  when you go into the work place,  chances are you'll
require knowledge of C to debug something or create a patch (bug
fix).  Or you'll be translating some older code into C++.  There's
many reasons to learn C.  It's the key player in C++ as a language.

And spend more than one day.  You can't learn how to pick your nose
properly in one day.  Take a good book (like QUE's _USING_C/C++_,
Special Edition) and learn C.  Read it for two weeks and simply 
absorb what you can.  Then grab the Waite Group's book and read it
cover to cover.  Program in both.  You'll be so glad you did.


Derek Douville
Technology Support Services
Cognos Help Desk, Ottawa


Chris Lloyd (clloyd@csn.net) wrote:
: rainer@deyke3.fc.hp.com (Rainer Deyke) wrote:

: >Jeff W. (psilocyn@ix.netcom.com) wrote:
: >: I just got Borland C++ 4.51, and there's a few questions I have. 
: >: Should I learn C or C++ first?  And, what benefits do they each have
: >: over each other?  I don't really know the differences between the two. 

: >Learn C first.  C++ is based on C but has some extra features, most of
: >which take a lot of extra space and slow down your program.  The main
: >advantage of C++ is inline functions.  C++ is also object oriented but
: >you can easily write object oriented code in C, it's just not a built
: >into the language.

: >--
: >+----------------------------------------------+
: >|    Rainer Deyke (rainer@mdddhd.fc.hp.com)    |
: >| "The Earth shall inherit the meek" - Carcass |
: >+----------------------------------------------+

: I skipped C and went straight to C++ and don't regret it at all. 
: Even though C++ is a superset of C. The programming technique is
: completely different. Go straight to C++.

: What you need is a good book to teach you C++ without C knowledge. 

: "Master C++"  by the Waite Group is a great book that has an
: interactive tutorial. It is fantastic and teaches C++ without C
: knowledge. Be aware that it is a long road to proficiency and you'll
: need many more books along the way.
Technical Details
Message-ID: <40mqib$msc@wormhole.cognos.com>
Path: arc1-ca.pugleaf.net!wormhole.cognos.com!douvilld
References: <3v6qkj$8ak@news1.best.com> <3v713f$2bd@ixnews6.ix.netcom.com> <3vr8mb$400@deyke3.fc.hp.com> <40m1bc$ffk@news-2.csn.net>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!wormhole.cognos.com!douvilld
From: douvilld@Cognos.COM (Derek Douville)
Newsgroups: rec.games.programmer,comp.lang.c++
Subject: Re: Should I learn C or C++ first?
Followup-To: rec.games.programmer,comp.lang.c++
Date: 14 Aug 1995 06:30:35 GMT
Organization: Cognos Incorporated, Ottawa CANADA
Message-ID: <40mqib$msc@wormhole.cognos.com>
References: <3v6qkj$8ak@news1.best.com> <3v713f$2bd@ixnews6.ix.netcom.com> <3vr8mb$400@deyke3.fc.hp.com> <40m1bc$ffk@news-2.csn.net>
NNTP-Posting-Host: aurora.cognos.com
X-Newsreader: TIN [version 1.2 PL2]