C questions

Mark Gorlinsky markg at amd.UUCP
Fri Jan 16 05:53:50 AEST 1987


In article <> 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.

>
>"... 95% of all C programmers couldn't give you a good
>explanation of the term lvalue..."
Any C programmer, professional or not, who has compiled a program that
contained the error "Illegal lvalue" knows that they tried to assign a
value to an expression that should not assigned a value.  The 'l' in lvalue
means "left" and refers to the left side of an expression, such as a = 5.


>
>"... Switch/case could be classified as rarely used and should be
>kept till later.
Who is this guy kidding!  Almost all the 'C' programs that I have written
contained at least one Swith/case statement.  Every 'C' program that has 
command line parameters should use the Switch/case statement to control
the arguments from the command line. 

 
>
>"... very few C programmers know much about sizeof..."
For the home hacker this maybe true but, for the professional dealing with
commercial code, not so.  The sizeof operator is great for dynamically 
allocating arrays via calloc() and malloc().  The sizeof operator is also
use to determine the storage size of integers on various machines and to aid
in porting code from one machine type to another.

 
>
>"... 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."
Typedef and #define are used inpart to add readability to the definition
of variables.  Typedef means just that, "Type definition", it does
not mean that new types of variables are defined.  Typedef provides more 
flexibility than does the #define when it comes to assigning names to "derived"
data types. 


>
>"... 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 for statement is the most common place to use the comma operator.  It allows
the placing of multiple expressions in various parts of the for statement.
You probably could live without it but, it is part of 'C' and sould be explained


>
>"... Leave the comma operator altogether. An intro book is no
>place for obscure and unmaintainable tricks..."
Leaving out any feature of the 'C' language in a book about 'C', would
be like taking a bath without a bathtub.  You would still have to find 
a bathtub to take the bath.  Besides, what right does the publisher have 
to tell someone else what they sould and shouldn't know.


>
>"... Pointers to functions ... few C programmers understand
>them or would ever need them..."
This is true but, a good explanation of them and more would know and 
probably use them.  Better to know it's there, than to have never known at all!



>
>"... a C programmer never needs to know what a byte is..."
Is this guy trying to say that a 'C' programmer also doesn't need to know
about integers, chars, doubles or floats.  Try explaining that the value
returned by sizeof, when used on an array of integers, is the number of chars
contained within that array.  Good Luck, and remember that only the size of 
char will remain constant from machine to machine.


Though the views may be short and few, remember the transmission time isn't!



More information about the Comp.lang.c mailing list