Path: utzoo!attcan!uunet!mcvax!ukc!warwick!maujt From: maujt@warwick.ac.uk (Richard J Cox) Newsgroups: comp.lang.c Subject: Re: lint question Message-ID: <83@poppy.warwick.ac.uk> Date: 13 Jan 89 15:10:28 GMT References: <491@babbage.acc.virginia.edu> <317@twwells.uucp> Reply-To: maujt@warwick.ac.uk (Richard J Cox) Organization: Computing Services, Warwick University, UK Lines: 25 In article <317@twwells.uucp> bill@twwells.UUCP (T. William Wells) writes: >In article <491@babbage.acc.virginia.edu> pts@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@uk.ac.warwick.cu BITNET: maujt%uk.ac.warwick.cu@UKACRL ARPA: maujt@cu.warwick.ac.uk UUCP: maujt%cu.warwick.ac.uk@ukc.uucp Richard Cox, 84 St. Georges Rd, Coventry, CV1 2DL; UK PHONE: (0203) 520995