Path: utzoo!attcan!uunet!lll-winken!ames!nrl-cmf!mailrus!uflorida!novavax!twwells!bill From: bill@twwells.uucp (T. William Wells) Newsgroups: comp.lang.c Subject: Re: lint question Message-ID: <317@twwells.uucp> Date: 10 Jan 89 15:39:31 GMT References: <491@babbage.acc.virginia.edu> Reply-To: bill@twwells.UUCP (T. William Wells) Organization: None, Ft. Lauderdale Lines: 26 Summary: Expires: Sender: Followup-To: Distribution: Keywords: In article <491@babbage.acc.virginia.edu> pts@watt.acc.Virginia.EDU (Paul T. Shannon) writes: : I've been following the lint discussion, and decided it was high : time for me to use lint myself. Here's a question for style experts: : Lint complains: : : 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 printf executes, i.e., either at the time you write the code or in the code itself before the printf executes. (Except that I/O errors need to be checked sometime after a flush has need done. But that is another can of worms entirely, caused by standard I/O buffering.) I just ignore the lint message. On the other hand, if it said that the function values were *sometimes* ignored, I'd go hunting for the portability problem caused by using the return value. --- Bill { uunet!proxftl | novavax } !twwells!bill