Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!csc.ti.com!ti-csl!tilde.csc.ti.com!pearl!pearl!mikep From: mikep@dirty.csc.ti.com (Michael A. Petonic) Newsgroups: comp.lang.c Subject: Re: Return value ignored warning from lint [was: Why use (void) func()] Message-ID: Date: 2 Oct 90 10:32:21 GMT References: <586@dptechno.UUCP> <1990Sep24.193012.14074@diku.dk> <12141@crdgw1.crd.ge.com> <4068@sactoh0.SAC.CA.US> Sender: news@pearl.dsg.ti.com (System News Administration) Organization: Texas Instruments, Speech Mushrooms. Lines: 28 In-Reply-To: jak@sactoh0.SAC.CA.US's message of 29 Sep 90 18:00:49 GMT In article <4068@sactoh0.SAC.CA.US> jak@sactoh0.SAC.CA.US (Jay A. Konigsberg) writes: >> What I do mind is when lint warns me about return values from >>printf being ignored, which I, as well as most people, routinely ignore. >>Our dain-bramaged lint does the annoying thing in both circumstances: > >Not necessarly. If I happen to write something like: > >fd=open("name", O_WRITE); >fprintf(fd, "some string with or without variables"); > >or dup() a file descriptor to stdout and use printf() to write to a >file, then I definiatly want to know about ignoring the return >value. Oh, come on. How many times do you put an IF around an FPRINTF? Now, if you're using sprintf() or fprintf() and want to get a count of the number of bytes output, then I can understand, but my usage of these library calls in that manner is less than 1%. I agree with Karl H's solution (using the varargs, etc.) -MikeP >------------------------------------------------------------- >Jay @ SAC-UNIX, Sacramento, Ca. UUCP=...pacbell!sactoh0!jak >If something is worth doing, it's worth doing correctly. If something is worth doing, it's worth doing repeatedly.