Can anyone recomend a good intoduction to C...

Grant Edwards grante at visi.com
Wed Mar 7 14:02:58 EST 2001


In article <983989153.204220 at newsmaster-04.atnet.at>, Werner Schiendl wrote:

>> >What use would it be to check the language?
>>
>> The point is that the more complex the language, the more
>> difficult it is to inspect the application.  You can look at a
>> few lines of C and have a pretty good chance at guessing what
>> they do.  In C++ it's much harder to look at snippet of code
>> and figure out what it's going to do.
>>
>
>At least if the design is bad.
>
>Usually an object oriented program should be easier to read.
>Just because the syntax does more closely resemble the way
>humans think.

It _should_ be easier to read.  But in my experience it isn't.

The problem is that C++ is a very complex language.  It's
difficult to determine by inspection what a piece of code does
because of all the overloading/templating/whatnot that C++
allows.  There are too many times when a line of code doesn't
do what it appears to do to a reader.

Just the problem of deciding whether "foo" is a local, global,
or instance variable can be difficult for a human inspector.
Throw in some cpp tricks and it's hopeless.  I know that C++
was supposed to eliminate the need for cpp, but it still gets
used.

>(But I saw enough examples that demonstrated just the
>opposite...)

In my experience, C++ is too complex a language to allow for
practical, thorough inspection of source code.  And since C++
still allows you to generate dangling pointers, memory leaks,
indexes out of range and whatnot, you _need_ to inspect source
code to detect many of those types of problems.

C also allows you to generate those problems, but the language
is simple enough that inspection is a practical exercise.

OTOH, Python (or Modula-3 or Smalltalk or ....) won't _allow_
you to generate a pointer to nothing or index off the end of an
array.  Additionally, they're far simpler languages than C++, so
other types of errors are easier to spot.

-- 
Grant Edwards                   grante             Yow!  Either CONFESS now or
                                  at               we go to "PEOPLE'S COURT"!!
                               visi.com            



More information about the Python-list mailing list