[ale] C programming books

Joseph Rattz Jr joerattz at yahoo.com
Thu Jun 3 11:39:10 EDT 1999


> I recommend that you buy a C++ book instead and
> learn that. There is
> absolutely no reason to learn plain old C any more

I just have to make an issue out of this statement.  I
am a C and C++ programmer and I am going to take a
public stand and say that I think C is suprerior to
C++ for most work, with the possible exception of GUI.
 And that exception is only due to the nice class
libraries that have been provided for free that could
have easily existed for C, but didn't for some reason.

I have heard people say that C was bad because it was
too complex due to the pointers and memory management
required.  Well...C++ inproves on this?!?  Please!  

I feel that in all the places I have worked only about
10% of the C programmers should have been allowed to
touch the code.  The other 90% should have been
fetching soft drinks or coffee.  And, make no mistake,
C++ is far more complex.  

Right now, I have inherited a C++ application that
compiles clean, and runs.  The first time it runs, it
core dumps.  The second time it runs, it produces
output that is accepted as usable.  However, if I try
to debug it, it causes a sig10 and core dumps the
debugger (dbx) on program load.  So, I can't debug it.
 BTW, we are talking Solaris 2.5.1, their C++ 4.2
compiler, and something like version 11s of rogue wave
I think.  The rogue wave seems to only be used for its
stl.  I have tracked that symptom of the problem
(sig10) to the fact that the code is using an stl map
where both the key and value are string templates.  I
have created a totally different stub program with no
code in it except for the declaration of the map, and
it produces the same sig10.  If I change the key or
the value to a type other than string template, such
as an int, the problem goes away.  Now, keep in mind
that the sig10 in the debugger occurs at program load,
so I can't debug it at all.  If you consider how much
here is getting done in undebuggable header files, one
might think some aspects of C++ are a bad idea.

Here are some of the other problems I have encountered
just while trying to resolve this:

Some syntax errors in my code cause the compiler to
core dump.  Never had that happen in C on any platform
I have used.

I have two books covering STL and they aren't the
same.  The same basic example in the books has
different syntax and slightly different methods, as I
racall.  One works with my compiler, and the other
doesn't.

A friend of mine was having a memory violation on an
NT Server app written with VC++ 5.0.  I debugged it to
a bug in the xstring header file.  There is a HUGE bug
if you are using the string template where if you
assign a smaller string literal to a stirng tamplate
that once contained a larger string literal, it will
violate memory.  I can;t believe a bug like this could
exist in such a basic class that is used by so many. 
When I found the bug, my friend contacted customer
support, and they had no official code fix.  Their
official work-around was to assign an empty string to
the template before assinging it to a bigger string. 
You had to do this every time you reassigned a value
to the string!!!  However, he was dissatisfied with
this and begged till they gave him an unofficial code
fix.  When he got off the phone, he found it wouldn't
even compile!  They actually called him bact to tell
him they forgot to give him part of it.  Once he got
it to compile, it still didn't fix the problem!  In
the meantime, I had notice that PJ Plauger was listed
as the author and had found his web site.  I
corresponded with him through e-mail to find out that
he was aware of the bug and had a corrected header
file.  And, it worked!!!  Odd that MS didn't have it
available!?  

I know at this point I am ranting, but the point I was
trying to make is that C is complex enough to make
most programmers incompetant, though I don't really
feel like the language is that difficult.  I am just
basing this on the majority of the code and
programmers I have seen.  C++ however, seems to be
compex enough that the language's authors have to
become involved to get things fixed.

Now, to bring this to an on topic point.  I am glad
that at this point, most of Unix/Linux is C based, and
I personally hope it stays that way.  It will be
faster and more stable that way.


--- Benjamin Scherrey <scherrey at switchco.com> wrote:
> I recommend that you buy a C++ book instead and
> learn that. There is
> absolutely no reason to learn plain old C any more
> and if you later
> decide to learn C++, you'll have to unlearn a bunch
> of bad habits that
> are common usage with C. You don't have to program
> object oriented to
> use C++. Just take advantage of it's easier to use
> constructs, type
> safety, great standard library (strings and
> containers oh my!) and
> you'll be a good bit further along than with plain
> old C. Its also
> much easier for a new programmer to learn than C.
> Besides, it pays
> better.
> 
> 	later,
> 
> 		Ben Scherrey
> 
> Tri wrote:
> > 
> > I know I asked this before but I'm going to ask it
> again...
> > 
> > I'm going to buy a C programming book  from
> Amazon.com very very soon.
> > Is there a "Must Get" book you can suggest for a
> beginner. I don't want
> > a very easy, hand holding book, just one that lays
> the basic groundwork
> > quickly and thoroughly and goes into detail about
> the advanced stuff.
> > 
> > Tri
> 
> 

===
Please don't add the e-mail address of this message to 
any e-mail address books.  Please use my normal e-mail
address (joerattz at mindspring.com) for any correspondence
other than the reply of a message I send you.  This is
because the address that is originating this message is
a temporary one.  Thank you.

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com






More information about the Ale mailing list