format string linting?

Michael P. Gerlek mikeg at c3.c3.lanl.gov
Sat Jan 26 06:06:42 AEST 1991


(This only *sounds* bizzarre... Trust me.)

Does anyone have a hack that will "lint" my format strings for printf,
scanf, and the like?  For example,

	char *s;
	printf("%d", s);

is icky, but lint can't see it.  Furthermore,

	int x,y;
	printf("%d %d %d", x, y);

is equally icky.

I really need a hack that will grind through thousands of lines of C
to find these yucky lines.  Ob. explanation: these errors crop up in
error code like:

	if (frob != notz)
	  printf("Internal error: frob (%d) != notz (%d)\n");

where only at certain high tide/moon phase conditions would these
error lines get printed...

Thanks.

-[mpg]
 mikeg at lanl.gov
 "...making the world safe for supercomputing."



More information about the Comp.lang.c mailing list