Return value ignored warning from lint [was: Why use (void) func()]

Michael A. Petonic mikep at dirty.csc.ti.com
Tue Oct 2 20:32:21 AEST 1990


In article <4068 at sactoh0.SAC.CA.US> jak at 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.



More information about the Comp.lang.c mailing list