casts to (void)

Thomas M. Breuel tmb at talcott.UUCP
Thu Aug 8 13:30:29 AEST 1985


In article <1310 at eagle.UUCP>, mjs at eagle.UUCP (M.J.Shannon) writes:
> > In article <116 at rtp47.UUCP> meissner at rtp47.UUCP (Michael Meissner) writes:
> > >Whenever I use things like printf with lint, I define things like:
> > >	#define	Printf	(void) printf
> > >	#define	Fputs	(void) fputs
> > That's a mediocre solution, it shouldn't be necessary lint should know the
> > set of standard functions which results needn't be used. It's not accept-
> > able to either put (void) in front of printf(), scanf(), ...etc. or make
> > defines like "#define Printf (void) printf".
> And programs that do this don't recover from write errors, like when a
> filesystem runs out of space.  That's what lint *correctly* complains about.

The fundamental problem here is that the way stdio indicates that
a write failed is just inconvenient. In 99.999% of all cases, you
don't want to care about failing printf's. The appropriate default 
action is to print a diagnostic message (where?) and to kill the
process, not to return a failure code that has to be checked
every single time you print something.

						Thomas.



More information about the Comp.lang.c mailing list