lint question

Henry Spencer henry at utzoo.uucp
Mon Jan 16 18:07:43 AEST 1989


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?

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 at zoo.toronto.edu



More information about the Comp.lang.c mailing list