Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!eecae!tank!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c Subject: Re: An interesting behaviour in printf Message-ID: <16456@mimsy.UUCP> Date: 20 Mar 89 19:06:10 GMT References: <960@Portia.Stanford.EDU> <15938@cup.portal.com> <1013@Portia.Stanford.EDU> Distribution: na Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 28 In article <1013@Portia.Stanford.EDU> joe@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@mimsy.umd.edu Path: uunet!mimsy!chris