lint question

Farrell Woods ftw at masscomp.UUCP
Thu Jan 12 01:36:16 AEST 1989


In article <491 at babbage.acc.virginia.edu> pts at 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?

Since the printf() family of functions is writing something to somewhere,
they return the number of bytes written (and -1 if they failed).  If you
want to ignore the return value and be in style (;-)), you can use a void
cast:

	(void)printf(....);

This signals that you are explicitly ignoring the returned value.


-- 
Farrell T. Woods				Voice: (508) 692-6200 x2471
MASSCOMP Operating Systems Group		Internet: ftw at masscomp.com
1 Technology Way				uucp: {backbones}!masscomp!ftw
Westford, MA 01886				OS/2: Half an operating system



More information about the Comp.lang.c mailing list