why "(void)printf(fmt);" besides lint(1)?

Henry Spencer henry at utzoo.uucp
Sun May 27 10:11:20 AEST 1990


In article <7486 at ncar.ucar.edu> steve at groucho.ucar.edu (Steve Emmerson) writes:
>Aside from getting lint(1) to shut up, why else would one write
>	(void)printf(fmt);
>rather than the simpler
>	printf(fmt);

Personally, this is one of the few places where I just refuse to use the
cast.  I consider it pointless clutter.  If lint objects, tough.

In the (relatively rare) event that I seriously care whether printf output
got out intact (fprintf output I often care about, but not printf), I check
ferror(stdout) afterwards.  That also lets me do one check after a number
of printfs, and avoids portability hassles over the return values.
-- 
Life is too short to spend    |     Henry Spencer at U of Toronto Zoology
debugging Intel parts. -Van J.| uunet!attcan!utzoo!henry henry at zoo.toronto.edu



More information about the Comp.lang.c mailing list