Strange C parses

ShanklandJA jas at drutx.UUCP
Wed Apr 25 03:39:28 AEST 1984


Two quick comments (no pun intended):

First, C comments are handled by the preprocessor, not the lexical analyzer,
at least by default.

Second, I don't want to make excuses for C's little lexical liberties,
but let's not forget that all the examples we've seen are pathological.
Inserting spaces at appropriate places in expressions is part of writing
clear code.  How often have you seen stuff like:

while ((*++c=*f)&&(d=='e'||d=='E')||dptr)  ...

I'm not saying that a programmer with even a little C experience can't
understand the above code fragment; I'm saying it's easier on the eyes
and mind to read:

while ( ( *++c = *f ) && ( d == 'e' || d == 'E' ) || dptr ) ...

Of course, all that white space wastes lots of disk space, but then, so
do comments :-)

Jim Shankland
..!ihnp4!druxy!jas



More information about the Comp.lang.c mailing list