C Review

Tom Stockfisch tps at sdchem.UUCP
Thu Jan 15 12:23:37 AEST 1987


(Email failed, so I posted this even tho there will probably be too many
responses)

In article <2313 at brl-adm.ARPA>
>"... 95% of all C programmers couldn't give you a good
>explanation of the term lvalue..."

I've never heard a *really* good explanation of lvalue, but it is an
essential concept to C (to any language?) and should be explained as
best one can.  If you don't think in terms of lvalues you make
mistakes like
	
	int	a[5];
	a =	1;
or
	(int *)b =	c;

>"... Switch/case could be classified as rarely used...

Disprove this by looking at various software projects and doing
	grep -l switch *.c | wc -l
compared to
	ls *.c | wc -l
Or do
	grep for *.c | wc -l
compared to
	grep switch *.c | wc -l

>...[switch should be] kept till later.

It is conceivable you might want to save the switch statement until you've
shown some sample programs if you're really keen on giving some
examples before getting very far.

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

Every C programmer I know knows about sizeof.  Many also have some
unfortunate misconceptions about it that it would be good for a
textbook to clarify.

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

All C programmers I know know all about typedef.  In fact, I would
say that *novice* programmers use this feature more than experts.
The expert says

	int	*(*f[10])();

and the novice says

	typedef	int	*PI;
	typedef	PI	(*PFPI)();
	PFPI		f[10];

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

All C programmers I know know about the "," operator.  The novices use
it for convenience, as in

	for ( i = 0, j = 0; ...; ++i, ++j )

and the experts use it in macro definitions.
Even if you decide never to use it, you MUST know what it's about if you
ever maintain anybody else's code.

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

Any book which omits the "," operator is grossly incomplete.

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

All C programmers I know understand them and use them.  Some have to use
typedefs to declare an array of them.

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

Impossible to comment on without knowing the context.

>Is this guy for real?

No.

|| Tom Stockfisch, UCSD Chemistry	tps%chem at sdcsvax.UCSD



More information about the Comp.lang.c mailing list