Newsgroups: comp.lang.c
Path: utzoo!henry
From: henry@utzoo.uucp (Henry Spencer)
Subject: Re: lint question
Message-ID: <1989Jan16.080743.2424@utzoo.uucp>
Organization: U of Toronto Zoology
References: <491@babbage.acc.virginia.edu>
Date: Mon, 16 Jan 89 08:07:43 GMT

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?

A troublesome point.  Although in general one should always check the
return values from functions that might fail, printf is a singularly
annoying case of a function that could fail but very rarely does, and
is a pain to check -- especially since the type of its returned value
is not portable among current Unixes.  My own inclination is to list
it in the "utter paranoia" category, to be checked if something crucial
is at stake (e.g. loss of user data), and to assume that otherwise the
failure is likely to be noticed without explicit attention.

Stdio is a glaring example of a library package that would benefit
greatly from a better error-handling mechanism.
-- 
"God willing, we will return." |     Henry Spencer at U of Toronto Zoology
-Eugene Cernan, the Moon, 1972 | uunet!attcan!utzoo!henry henry@zoo.toronto.edu
