C questions

dave at murphy.UUCP dave at murphy.UUCP
Wed Jan 21 08:33:55 AEST 1987


Well, this one is bound to draw a lot of responses, so here's my $.02 worth:

>"... 95% of all C programmers couldn't give you a good
>explanation of the term lvalue..."

If they can't, then somebody isn't doing their job.  Lvalue isn't that difficult
a concept to get hold of; it's just something that can have its value changed
by one of the assignment operators: =, ++, --, and the <op>= type things.
Most of the time it's not that hard to figure out: if x is a variable, then
"x" is an lvalue (it's okay to say "x = 2"), but x+1 isn't (it's not okay to
say "x+1 = 2").

>"... Switch/case could be classified as rarely used and should be
>kept till later.

Wrong.  Which 3 out of 4 doctors did this guy get this from?

>"... very few C programmers know much about sizeof..."

This has not been my experience.  Even if you're not doing systems work,
you need to have a grasp of sizeof to do certain common things.  For
example, to allocate a space for something with malloc, you *must* have
sizeof to tell malloc how big a space to allocate.  (Unless you want to
hard-code the size in, but if you do, I don't want to maintain your
program.)  I have an application which needs to treat structures of
varying sizes in a type-independent manner; by judicious use of sizeof,
I can change the elements in the structures without having to alter
the code.   Without sizeof, it would be a nightmare.

>"... 99%  of  all  professional C  programmers  have no idea
>what typedef is all about, couldn't care less and probably
>won't ever need it."

Well, I tend to not use typedef quite as much as some people.  Then
again, I don't use the shift operators that often either, but that
doesn't give me any right to scream that "no one wants it".

>"... 99%  of  all  professional C  programmers  have no idea
>what the comma operator is all about, couldn't care less and
>probably won't ever need it."

The comma operator has its uses.  There are a couple of common
idioms: using it to increment two or more variables in lock-step
in a for or while loop, and reading a line from a file and
simultaneously checking for EOF in a while loop.  Also, in the
ANSI draft, the comma is defined as a sequence point which
forces the thing on the left to be evaluated before the thing
on the right, necessary for some types of numerical work, for
proper handling of volatile things like device registers, and
a million other uses.

>"... Leave the comma operator altogether. An intro book is no
>place for obscure and unmaintainable tricks..."

This is personal flaming on the part of the author, not to be
given the courtesy of a response.

>"... Pointers to functions ... few C programmers understand
>them or would ever need them..."

Again, this may not be something that you need very often, but
when you run into it in a program and run to your book and look
it up and find it explained only as "something you don't need
to know about", you're going to be very disappointed in the author.

>"... a C programmer never needs to know what a byte is..."

It's pretty hard to describe any concept of type sizes and storage units
without knowing what a byte is.  In fact, it's damned difficult to do
any kind of programming at all without knowing what a byte is.  In every
"introduction to Fortran" course that I've ever seen, they start out by
explaining about bytes and words.  Not telling the student about bytes
is like trying to explain English to an illiterate person and then
telling them that they don't need to know what letters are. 

General comments: Please tell us the name of this reviewer, so that
I can make sure to avoid his/her work.  Words like "99%" and "never"
indicate that the author is putting his personal predjudices ahead of
his (or anyone else's observations), and that he is determined that
what he says should be regarded as truth, despite his not having any
facts, studies, or even reasonable subjective observations to back
him up.  Trying to pass off opinion as fact is a tactic commonly
used by those who have no basis in logic to argue from.  Furthermore:
statements like  "99% of all professional C programmers" are a psy-
chological ploy; the idea is to convince you that the author is a
professional programmer who is familiar with nearly everyone in the
field, and that if you disagree with him, you must not be a professional
programmer.  (It's sort of like the arch-reactionary who tells you that
"all decent and moral Americans" support his position, and that if you
disagree, you must be a Communist and a traitor.)  Phrases like "never
need to know", and "couldn't care less and probably won't ever need it"
indicate that the author believes that this information should be held
back from students, presumably because the concepts are too far over
their heads, so that they can be reserved for the "professional"
programmers who are of course the only ones that can use them as God
(and Dennis :-) intended.  This strikes me as an example of the old
"I know something that you don't know, and for your own good I'm not
going to let you find out" mentatility; it's sort of like the sysadmin
for a university machine who won't let students run the debugger because
he doesn't want them "taking CPU time away from those of us who can put
it to good use".  It's terribly infantile, just a way to show superiority.
As this usually is done to mask a perceived or real inferiority, I would
wonder how much the author actually knows about the things he criticizes.
If you know this guy, don't ever get into a political argument with him!

Well, I'll get down from my soap box (or maybe it's a chad box) now.
Sorry about the long-winded message, especially the last bit.  It's just
that it gets my goat when people like this go around presenting themselves
as authorities in any field, but especially in computer science; 
computer types have a bad enough reputation with non-computer types as
it is.

P.S.: This is all assuming that the material quoted in the original article
was a legitimate review; now that I think about, it sounds suspiciously
like satire.  If it is, I apologise.

P.S.S.: This wouldn't happen to be John Dvorak, would it?
---
"But I *like* cheap plastic keyboards!" -- Greg Hawkes

Dave Cornutt, Gould Computer Systems, Ft. Lauderdale, FL
UUCP:  ...!{sun,pur-ee,brl-bmd,bcopen}!gould!dcornutt
 or ...!{ucf-cs,allegra,codas}!novavax!houligan!dcornutt
ARPA: dcornutt at gswd-vms.arpa (I'm not sure how well this works)

"The opinions expressed herein are not necessarily those of my employer,
not necessarily mine, and probably not necessary."



More information about the Comp.lang.c mailing list