Fao said:
A guy at
http://www.embedded.com gave his opinion on the C language and I
was shocked to see the number of supporters for the author. I also find it
hard to believe that 99% of all code has memory leaks; but, I suppose I
could be wrong.
See what you think:
http://www.embedded.com
showArticle.jhtml;jsessionid=4DOBHEJ2YZUKUQSNDBCSKHQ?articleID=15306089
Sean
``C, the most popular of all embedded languages, is an utter disaster, a
bizarre hodgepodge meant to give the programmer far too much control over
the computer.''
Too much of what he says is aimed around miniscule problems that clueless C
programmers can fall into.
Oh, I can dereference a null pointer, I don't have to get a diagnostic for
doing so, that is right. But only a beginner would so. And as such, such a
novice shouldn't be using the language for _any_ serious development until
they have actually understood the language. I really don't see the logic.
(Using a chainsaw as an example after reading Richard Heathfield's post) I
can walk around with a chainsaw and cut people up with it, but does this
mean that I should? And because I can do this, does it make a chainsaw a
crappy tool?
Understanding the semantics of C is not something that will be achieved in
21 days, 24 hours, or what have you. What does this guy want? Does he
actually want to learn the pitfalls of C so he knows what to avoid and to
better himself as a programmer in C or does he want to be able to use a
language which is completely faultless? Oh, perhaps he would like to design
such a language that is entirely faultless. I think his criticisms are
extremely poor and could be concluded by anyone that say, finished reading
``Teach Yourself C In 21 Days".
``But no language should allow stupid mistakes like buffer overruns or
undetected array overflows. ''
They are only mistakes when the careless C programmer is using them in
incorrect situations.
I myself, have never had a problem with buffer overflows. You might find
yourself fall afoul to this issue if you haven't given the algorithm for
solving a problem, some actual thought.
buffer overflows, heap overflows, double frees', one byte overflows/frame
pointer overwrite, integer overflows; If you fall afoul to any of these,
that is the problem of the bloody careless programmer, not the language.
``Geodesic claims 99% of all PC programs (most written in C and C++ of
course) have memory leaks, all caused by poor use of malloc() and free().''
And of what percentage is this done by the careless programmer? I wouldn't
be surprised if careless programmers counted for the majority. But he just
fails to hint at that because it wouldn't make his poor point.
``Here's a C hint that will improve your job security: embrace double
indirection. Even better, try triple. Real programmers use quadruple. The
only limit to the number of asterisks placed in front of a pointer is the
size of one's cojones or how adventurous you feel. ''
Another poor criticism. Again, who would use excessive indirection
constantly? If not for an ioccc entry then I would say a beginner. But then,
the only people fooled by this article would be beginners of C.
``Even something as simple as integer math produces unexpected results:
20,000 + 20,000 is (ta-da) a negative number. Is this cool or what! ''
He could achieve proper results with the 'U' suffix to denote an integer
constant of unsigned int, is that cool or what! But whose fault is that?
Certainly not the language's.
``C has no formatting rules. It's easy and usual to write source in
astonishingly cryptic ways. Any language that allows utterly random use of
the ENTER key (it's perfectly legit to hit ENTER after almost every
character in C) is more an encryption tool than an aid to creating reliable
and maintainable code. ''
You would have to be a complete retard to not be able to format your code
correctly. This is _another_ poor criticism.
``No other language has an obfuscated code contest. Win by writing code that
works but that's so convoluted no C expert can understand why. Most of the
entries look like a two year old hit a few thousand random keys. And no, I'm
not putting the URL of the contest here; these people are code terrorists
who should be hunted down and shot. ''
Complete drivel. These contests are done only for fun. No serious
applications are being developed.
``A great programming language should encourage users to create perfect
code.''
He should define ``perfect''. This of course is something based on ones
ideological reasoning.
I personally think one can achieve ``perfect''(robust, flawless) code in C
by undertsanding its pitfalls.