lint fails to be my friend

David Steffens das at eplunix.UUCP
Thu Apr 4 08:05:13 AEST 1991


When beginning maintenance activities on code that someone else has written,
the first thing I do is to run lint on the code to see what pops out.
This time, lint failed to find something that I think it should have.

Try the following on your favorite flavor of lint.  The first four if's
generate "variable may be used before set" complains as expected.
The fifth if statement does not.  I think it should.  If not, why not??
Tested on 4.2bsd, 4.3bsd, SunOS4.0.3, SunOS4.1 and RTU5.0 (SysV variant).

main()
{
	int foo;
	int *bar, *blap, *flap;
	int baz[10];

	if (foo == 0)
		printf("Yikes!\n");
	if (bar == 0)
		printf("Egads!\n");
	if (*blap == 0)
		printf("Gadzooks!\n");
	if (flap[2] == 0)
		printf("Ack!\n");
	if (baz[2] == 0)
		printf("Eh?\n");
	exit(0);
}
-- 
David Allan Steffens       | I believe in learning from past mistakes...
Eaton-Peabody Laboratory   | ...but does a good education require so many?
Mass. Eye & Ear Infirmary, 243 Charles Street, Boston, MA 02114
{harvard,mit-eddie,think}!eplunix!das      (617) 573-3748 (1400-1900h EST)



More information about the Comp.bugs.4bsd.ucb-fixes mailing list