[Edu-sig] C++ As a First Language

Bruce Eckel bruce@eckelobjects.com
Wed, 01 Mar 2000 06:59:02 -0800


This is actually correct ISO C++; there is a special case
for main() that allows you to leave out the return
statement and it defaults to return 0. If it doesn't
compile, it means your compiler is broken.

Not defending C++ over Python in any way, however. One of
my python programs is a rewrite of the equivalent C++
version (a code extraction program for the Java book), and
it runs faster (because C++ iostreams turn out to be badly
implemented, but universally so -- Dan Saks has written a
series of articles on this in the C/C++ Users Journal). Of
course, the python version took 1/10th of the time to
develop, is 1/10th the size, does more, and is WAY easier
to modify because I don't get scared when I look at it (I
worked hard to make the C++ program nicely OOPed etc., but
it's still scary).

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D
Bruce Eckel    http://www.BruceEckel.com
Contains free electronic books: "Thinking in Java" &
"Thinking in C++ 2e"
Please subscribe to my free newsletter -- just send any
email to:
join-eckel-oo-programming@earth.lyris.net
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D


*********** REPLY SEPARATOR  ***********

On 2/29/00 at 2:18 AM Tim Peters wrote:

>[Jason L. Asbahr]
>> Most readers have probably seen this already, but there
is a
>> fascinating interview with Stroustrup on Slashdot, in
which
>> Bjarne asserts that, yes, indeed, C++ *is* a great first
language.
>> :-)
>>
>>
http://slashdot.org/article.pl?sid=3D00/02/25/1034222&mode
=3Dthread
>
>His paper is at:
>
>    http://www.research.att.com/~bs/new_learning.pdf
>
>It's interesting reading, but is overwhelmingly concerned
with why C++ can
>be easier to teach than C, and C is really the only other
language
>considered.  Here's his first example:
>
>int main()
>{
>    using namespace std; // gain access to standard
library
>
>    cout << "Please enter your first name:\n";
>    string name;
>    cin >> name;
>    cout << "Hello " << name << =B4\n=B4;
>}
>
>While equivalent C is truly a mess (mostly because you
can't know in advance
>how much space to allocate for "name"), it's prophetic
that this first C++
>example doesn't compile:  main is declared to return int
but lacks a return
>stmt.  My Python version compiled the first time <wink>:
>
>name =3D input("Please enter your first name:")
>print "Hello", name
>
>although-at-this-level-you-may-as-well-teach-basic-ly y'rs
 - tim
>
>
>
>_______________________________________________
>Edu-sig mailing list
>Edu-sig@python.org
>http://www.python.org/mailman/listinfo/edu-sig