lint question

Richard J Cox maujt at warwick.ac.uk
Sat Jan 14 01:10:28 AEST 1989


In article <317 at twwells.uucp> bill at twwells.UUCP (T. William Wells) writes:
>In article <491 at babbage.acc.virginia.edu> pts at watt.acc.Virginia.EDU (Paul T. Shannon) writes:
>: function returns value which is always ignored
>:     fprintf       printf
>:
>: Is it bad style to use these functions without also checking the
>: returned value?
>
>The return values of the printf family functions are not very
>consistently defined. Because of this, one should never use their
>return value.  You have to do the checking of printf before the


There are situations where you have to check the return values.
e.g. when fprinting to a pipe or socket, in this case the process at
the other end of the pipe may have died, and in this case the fprintf
_will_fail_. This was causing a major bug in a program I wrote, and
it was in pure desperation I checked the return value.

- RC

/*--------------------------------------------------------------------------*/
JANET:  maujt at uk.ac.warwick.cu     BITNET:  maujt%uk.ac.warwick.cu at UKACRL
ARPA:   maujt at cu.warwick.ac.uk	   UUCP:    maujt%cu.warwick.ac.uk at ukc.uucp
Richard Cox, 84 St. Georges Rd, Coventry, CV1 2DL; UK PHONE: (0203) 520995



More information about the Comp.lang.c mailing list