An interesting behaviour in printf

Chris Torek chris at mimsy.UUCP
Tue Mar 21 05:06:10 AEST 1989


In article <1013 at Portia.Stanford.EDU> joe at hanauma.stanford.edu
(Joe Dellinger) writes:
>I ran my [printf] program through lint with no complaint. Why doesn't
>"lint" catch this sort of error? And yes, I know, lint can't be expected
>to know the internal details of weird varargs programs...
>
>	BUT, printf is hardly "weird". It gets used ALL the time.
>Why did the creators of lint not tackle error checking for all the
>varargs programs in the standard libraries?

Because it was hard.

>Will "ANSI Lint" solve this problem? If no, why not? It seems there
>is no better reason than laziness...

Or disinterest.

Here is what the 4.3BSD-tahoe lint has to say:

	% cat foo.c
	main() { char foo[10]; printf("%s\n", foo[1]); }
	% lint -h foo.c
	foo.c(1): warning: printf: (char *) format, (char) arg (arg 2)

The change is due to Arthur Olson (elsie!ado).
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at mimsy.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.lang.c mailing list