Dealing with pointer freaks
Chris Sherman
sherman at unx.sas.com
Tue Jun 25 20:02:31 AEST 1991
In <2075 at manta.NOSC.MIL> grantk at manta.NOSC.MIL (Kelly J. Grant) writes:
>In article <6470 at goanna.cs.rmit.oz.au>, ok at goanna.cs.rmit.oz.au (Richard A. O'Keefe) writes:
>> In article <MIKEG.91Jun22125223 at c3.c3.lanl.gov>, mikeg at c3.c3.lanl.gov (M. P. Gerlek (hack grad student)) writes:
>> > I have this officemate ... who considers himself a competent C programmer,
>> > but insists on writing what most of us consider very bad code.
>>
>> Be clear about what you mean by "bad".
>> > No kidding, he writes ... *(x+i) ... [instead of] ... x[i] ...
Real C Programmers (TM) aren't bothered by *(x+i). On the other hand,
C Programs who used to be Pascal (or whatever) programmers are. :-)
Actually, I don't have a problem with *(x+i) because when the code gets
ugly, I can decompose the pointer line into something that looks like
*(x+i), and be able to understand it more.
>Code written in a shop *should* conform more or less to a certain style
>(whatever the style may be). This is especially true for a project
>where one person is working alone. In this situation, if the person
>doing the project can't finish for some reason, then someone else is
>going to have to come in and pick up the ball. If the person's code is
>written in an "unintelligible" style, then more money will be lost by
>the second person either having to waste time trying to read the code,
>or having to rewrite it.
This is always true. The grey area between personal style and group style
is a religious issue which will last longer than any of us.
IMHO, leave the dude alone. Jump up and down when you find major problems
in his code like:
char *d="068B9669996E9EA9E999E9DB999ACA9F8C8F",*p="12342506775730",o[480],*r,*q,
c,*z,*e,x,l=80,y='0';s(){memset(o,' ',480);z=o;}main(){s();while(c= *p++)if(c-=y
){for(r=z+320,e=d+c*5;r>=z;r-=l,e--)for(x=(*e-y&~15)?*e-'A'+10:*e-y,q=r+4;x;x>>=
1,q--)if(x&1)*q='*';z+=6;}else{for(r=o;r<o+480;r+=l)printf("%79.79s\n",r);s();}}
but for things like *(x+i), don't worry about it.
--
Chris Sherman .................... sherman at unx.sas.com |
,-----------------------------------------'
/ Q: How many IBM CPU's does it take to execute a job?
| A: Four; three to hold it down, and one to rip its head off.
More information about the Comp.lang.c
mailing list