Why does S5 lint dislike all casts to long?

Doug Gwyn <gwyn> gwyn at brl-tgr.ARPA
Wed Nov 21 03:25:36 AEST 1984


I think Geoff's "lint" has several more bugs than the current version.
The ONLY spurious "lint" messages I get are due to its lack of
understanding of semantics:

	-  exit( retval );	does not return;
		/*NOTREACHED*/	helps but the main() routine is still
				expected to return an int value even
				though all termination is via exit().

	-  the (char *) returned by malloc() is guaranteed to be
		properly aligned so that coercion to any other pointer
		type will work properly.  Since "lint" doesn't know
		about this property, it warns about incompatible
		pointer types when it sees the coercion.  A similar
		problem occurs when casting back to a (char *) for
		free().

I maintain thousands of lines of source code that pass through "lint"
(SVR2) with absolutely no warning or error messages other than those
noted above.  I find "lint" to be very valuable in reducing bugs and
detecting module design flaws (unused parameters, etc.).

I note that much of the AT&T UNIX user-mode source code has had bugs
that have shown up under "lint".



More information about the Comp.lang.c mailing list