[net.lang.c] C Style Wishes

day@kovacs.UUCP (Dave Yost) (09/30/85)

A few suggestions:

I am porting a large system (which shall remain
nameless) to the Gould.  I have found one bug already,
which was caused by the lack of signed characters on the
Gould.  So, what do you suppose I do next?  Of course, I
decide to go through all the code looking for all the
char declarations to see where else this problem may
bite.  Of course, I use the handy `grep' utility.  But
the declaration style used makes my grep output
incomplete.  I find lots of declarations like:

	register char *cp,
		      c;

Please, folks, use

	register char *cp;
	register char chr;

instead.  It helps when you need to do a grep, and if
the declarations have register storage class, as here,
it helps you count register declarations (or better yet,
you can prioritize them with Reg1, Reg2, etc. as defined
for the host machine in a standard include file).

And while I'm at it, most of us look at C source as
manifested on a screen through an editor, rather than
with ink on paper, and often, we want to look at all the
places where a variable is referenced.  Ever notice that
searches for single-letter variable names tend to find
lots of stuff you aren't looking for?

Thanks.  Now I'll go and put on my asbestos suit for
a couple of weeks.

--dave

darryl@ISM780.UUCP (10/04/85)

Hear, hear!  That's why I like to write my function declarations as

char *foo( a, b, c ) int a; char *b; double c; {


	    --Darryl Richman, INTERACTIVE Systems Corp.
	    ...!cca!ima!ism780!darryl
	    The views expressed above are my opinions only.

hamilton@uiucuxc.CSO.UIUC.EDU (10/09/85)

do you guys use screwdrivers as chisels, too?  and then complain
when it doesn't work so well, "hey people, use softer metal!"? :-)
sounds like you need to write yet-another-cross-referencer...

seriously, grep is great, and i couldn't live without it, but it
can't do EVERYthing.