Dealing with pointer freaks

M. P. Gerlek hack grad student mikeg at c3.c3.lanl.gov
Sun Jun 23 04:52:23 AEST 1991


Okay, so here's the deal:  I have this officemate (who shall remain
nameless :-) who considers himself a competent C programmer, but
insists on writing what most of us consider very bad code.  No
kidding, he writes:

	for (i=0; i<n; i++)
	  printf("%d\n", *(x+i));

instead of:

	for (i=0; i<n; i++)
	  printf("%d\n", x[i]);

There is not a single ``['' or ``]'' is his entire code.  Anywhere.
Except maybe for declaring arrays.  He even does this for indexing
into multiply dimensioned arrays.

He correctly argues that array syntax is equivalent to straight
pointer syntax, and claims he can "understand" the code he's doing
much better his way.  So, while he gets points for having a wonderful
grasp of pointers and indirection, his code is totally meaningless to
the rest of us.

The problem: the code he's writing probably won't be used by anyone
but him, so he sees no need to try and conform to anything
"conventional".  We argue that when he gets out into the Real World
he'll be screwed -- and he says he'll deal with that later.

So what can we do?  How can we convince him of the error of his ways?
(half :-)

PS- Can someone mail me an ftp site for the Indian Hill style guide?

-[mpg]
 mikeg at lanl.gov
 "Bond top cheese."


--



More information about the Comp.lang.c mailing list