casts to (void)

foss foss at ihuxe.UUCP
Tue Aug 6 22:46:15 AEST 1985


> > The people proposing ways of making
> > 	(void)printf( ... );
> > easier to enter into their code are missing the point of lint's
> > complaint!
> > 
> > The printf() function CAN FAIL and if you don't test for it,
> > Murphy says that it WILL fail, under the worst possible
> > circumstances (e.g., while updating YOUR pay record).
> > Instead of looking for ways to avoid testing printf return,
> > how about making your code more robust.
> 
> I just checked the manual page on printf(3), both on this machine (2.xbsd),
> and on one of the local vaxen (4.2bsd, with local hacks).  Neither documents
> a return value for printf, under normal or erroneous circumstances.  How does
> one check?  


The subroutine printf(3) calls the system call write(2).
If sucessful, the return value is set to the number of characters 
written, else -1 is returned and errno is set to describe the error.



More information about the Comp.lang.c mailing list