Newsgroups: comp.lang.c Path: utzoo!lsuc!dave From: dave@lsuc.uucp (David Sherman) Subject: Re: Use of " ? : " in format param to printf Date: Thu, 26-Jan-89 21:27:15 EST Summary: what if you ignore SIGFPE? Message-ID: <1989Jan26.212721.10913@lsuc.uucp> References: <1454@leah.Albany.Edu> <8801@alice.UUCP> Organization: Law Society of Upper Canada, Toronto In article <8801@alice.UUCP>, ark@alice.UUCP (Andrew Koenig) writes: > > printf(count == 0 ? " ---- " : " %4.0lf ", sum / count); > > > Does it matter if there are unused arguments to printf? > > It's OK to have unused arguments in printf, but they'll be > evaluated whether they're used or not. Thus in this example > if count is 0, the likely result is a divide by zero error. Well, you could always signal(SIGFPE, SIG_IGN) before this. Kind of kludgey, but I think it would get around that problem as long as you're running UNIX... David Sherman -- Moderator, mail.yiddish { uunet!attcan att pyramid!utai utzoo } !lsuc!dave