C questions (kinda long)

Donald L. Nash dlnash at ut-ngp.UUCP
Thu Jan 15 08:46:21 AEST 1987


I tries mailing this to Mr. Steele, but the return address was just
"Peter Steele - Acadia", no UUCP path or anything like that.  So here
is my stab at answering:

In article <2335 at brl-adm.ARPA>, Peter Steele - Acadia writes:
> I am currently finishing up a new text book on C with a colleague
> of mine and we just received the last of several technical reviews.
> This particular reviewer makes some statements that we find hard
> to accept. However, we're just two people, so we decided to get
> some opinions from other C programmers. Below is a list of some
> his statements. Is this guy for real? Your comments would be
> greatly appreciated. Incidentally, the text is not an intro
> text, it assumes the reader has finished a course in Pascal.
> 
> "... 95% of all C programmers couldn't give you a good
> explanation of the term lvalue..."
> 

For the longest time, I didn't know what an lvalue was, but that was when I
was still inexperienced with C.  After becoming more knowledgeable about C
I found out what an lvalue was and that is probably the case with other
programmers as well.

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

I disagree with this.  Switch is a valuable tool for making multiple decisions
and should not be covered up.

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

I find this very difficult to believe, especially in UN!X environments
where the system calls need to know the size of the objects they are
operating on.

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

Then 99% of all professional C programmers are grossly underinformed and
overworked.  Again, I find this very difficult to believe.  Typedefs make
things like declarations and casts much easier as well as providing for
information hiding (who cares what a FILE is as long as it works).  I
can't believe that any C programmer with any kind of experience would not
know or care about typedefs.

> "... 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."
> 
> "... Leave the comma operator altogether. An intro book is no
                                               ^^^^^ ^^^^
> place for obscure and unmaintainable tricks..."
> 

I'll admit that the comma operator may be one of C's less utilized operators,
but not to the extent that 99% of the professional C programmers don't
know or care about it.  When you need it, you really need it and there
is no substitute for it.  As for it being obscure and unmaintainable, that
is only the case if people are not taught how to use it properly.  Besides,
you said that this book is not an intro book, so that argument is invalid.

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

The only thing hard to understand about a pointer to a function is how to
declare it; int (*funct)() is a bit tricky, especially when you have arrays
of them or functions returning them, but they also fall into the category
of "if you need them, you really need them".  Consider writing a general
purpose sorting algorithm which sorts anything in any order.  You simply
give it a pointer to a compare function and a pointer to a swap function
and a pointer to a function which knows how to step through an array or
list of these objects and off you go.  Try doing this seemingly simple task
without using pointers to functions.

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

If he is going to do system programming he better know what a byte is!

Off hand, I would say that whoever wrote this review has a very low opinion
of C programmers.  He seems to think of them as novices who don't know or
care about the power of the language they are using and he seems to want
to keep it that way.  Maybe he dislikes well written software.  In any case,
I would not take his comments too seriously.

Just so you know, I have only known C for about a year and a half, so I am
no wizard.  But even at that, I am very comfortable using all of those
constructs which this guy said most programmers don't know or care about.

Hope this helps.  Oh yeah, usual disclaimers about by employer apply.

				Don Nash

UUCP:    ...!{ihnp4, allegra, seismo!ut-sally}!ut-ngp!dlnash
ARPA:    dlnash at ngp.CC.UTEXAS.EDU
BITNET:	 CCEU001 at UTADNX, DLNASH at UTADNX

UUU       UUU
 U         U                The University of Texas at Austin
 U     TTTTUTTTTTTTTT              Computation Center
 U     T   U TT     T
  U       U  TT            "The world is basically non-linear."
   UUUUUUU   TT
             TT 
            TTTT



More information about the Comp.lang.c mailing list