Subject: Re: bin/19381: netstat shows negative percentage
To: Martin Husemann <martin@duskware.de>
From: Greg A. Woods <woods@weird.com>
List: netbsd-bugs
Date: 12/14/2002 14:24:39
[ On Saturday, December 14, 2002 at 12:17:13 (+0100), Martin Husemann wrote: ]
> Subject: Re: bin/19381: netstat shows negative percentage
>
> On Sat, Dec 14, 2002 at 10:59:44AM +0000, David Laight wrote:
>
> > + totpct = (totmem < 100) ? 0 : totused/(totmem/100));
> > to avoid nasty FP arithmetic.
>
> I keep forgetting what the consensus was on the final C 99 standard: does
> this force evaluation order? ISTR only assigning to temporaries did the
> trick, while this allows the optimizer to rearange things.
If ?: doesn't evaluate the test expression first then the language is not C
(IMVNSHO)
Besides, in the above there are no worries anyway!
--
Greg A. Woods
+1 416 218-0098; <g.a.woods@ieee.org>; <woods@robohack.ca>
Planix, Inc. <woods@planix.com>; VE3TCP; Secrets of the Weird <woods@weird.com>