Path: utzoo!attcan!uunet!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!rpi!dali.cs.montana.edu!milton!uw-beaver!Teknowledge.COM!unix!husc6!spdcc!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: Why use (void) func() ? Message-ID: <18307@haddock.ima.isc.com> Date: 28 Sep 90 21:26:12 GMT References: <586@dptechno.UUCP> Reply-To: karl@kelp.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 21 In article ghoti+@andrew.cmu.edu (Adam Stoller) writes: >I happen to agree that having printf() return an int is rather a waste, >but if/when it bothers me, I either go through the code and put the void >cast in front of each printf, or [fake it with a macro]. In other words, you treat the symptoms instead of the disease. My opinion: the disease is pretty mild, but so are the symptoms (a single entry in one line of lint output); and I'd rather keep the latter around in case I someday decide to repair the former. I actually have one program that lints cleanly, modulo lint bugs, and does not do any such fudging: output is done with void pprintf(Player *p, char const *fmt, ...) { va_list ap; va_start(ap, fmt); if (vfprintf(p->ofp, fmt, ap) < 0) bugcheck(); va_end(ap); if (fflush(p->ofp) == EOF) bugcheck(); } Karl W. Z. Heuer (karl@kelp.ima.isc.com or ima!kelp!karl), The Walking Lint