C Review

Mark H. Colburn mark at ems.UUCP
Fri Jan 16 12:39:31 AEST 1987


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

I would say that there may be a fair number of people who do not know
what an lvalue is, however, in order to use pointers, they have to have
the concept of an lvalue down pat.  A rose by any other name...


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

I would say that this is very wrong.  I have seen a lot of switch/case
constructs around.  There may be a lot of programmers that do not use
them, prefering to use deeply nested if/then/else structures instead.
This however does not mean that it should not be taught.  Programmers
should know the alternatives and use which ever method they prefer.


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

I would say this is wrong.  A lot of programmers don't USE the sizeof
'function' when they should, but that does not mean that they do not
know about it.  Try {m|c}alloc()'ing a structure without it.


4. "... 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."

Once again, I think that this is a case of programmer preference.
Some programmers typedef EVERYTHING.  Other programmers do not.
Once again, give the reader a choice, show the alternative and let
them make up their mind what they want to do.  A hint, more easily
maintained code can come about due to the use of typedefs.  Typedef
bool, or byte comes to mind.  However, there are very few things that
can be done with typedef that cannot be done with a #define <typename>


5. "... 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."

This may or may not be true.  I am not altogether clear about the 
use of the comma operator.  It can be useful in constructs such as
for() and while(), but other than that...
(This is more a personal comment than anything else...)


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

Once again, I don't think it should be left out.  It should be taught
so that the reader know what it is when he/she comes across it in code.
Either that or they will sit and scratch their heads when they do, thinking
"That's not legal, is it?..."

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

It may be true that few programmers understand them, but that may be
due to the fact that they were never taught them in the first place.
They can be very useful, portable, timesaving and efficient.

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

Wrong.  Maybe a programmer doesn't need to know what a computer is either?
A writer has to know what paper is before he writes on it.  A programmer
needs to know what a byte/word/K is before they write into it.  Besides
a programmer that did not know what a byte is would be lost in the work
place.


It sounds as if your reviewer could stand to go back to school.  It sounds
like I would not like to have to maintain the code that he wrote if he
does not know what this stuff is.  Maybe he just has a low opion of other
programmers or programmer's intellects.  I don't know, either way, I don't
think that his comments were valid.
-- 
Mark H. Colburn        UUCP: {rutgers|amdahl|ihnp4}!{dayton|meccts}!ems!mark
EMS/McGraw-Hill         ATT: (612) 829-8200
9855 West 78th Street
Eden Prairie, MN 55344



More information about the Comp.lang.c mailing list