Subject: Re: bin/19381: netstat shows negative percentage
To: David Laight <firstname.lastname@example.org>
From: Greg A. Woods <email@example.com>
Date: 12/17/2002 20:40:24
[ On Mon, Dec 16, 2002 at 02:37:03PM +0000, David Laight wrote: ]
> The re-ordering issue is whether the compiler is allowed to
> evaluate totused/(totmem/100) as (totused*100)/totmem.
> IIRC K&R C did allow re-ordering, and the C99 standard disallows
Nope, definitely not. The parentheses, along with , ->, and ., are
clearly defined in K&R 1st-edition as having the highest precedence of
any and all operators in the C Language. See page 49.
So, even before the standard there was no such thing as "allowing" the
reordering of evaluation of a parenthesised expression.
(I suppose it would be interesting from a historical point of view to
learn whether or not either of Ritchie's compiler or the PCC actually
did such re-ordering despite the rules K&R wrote in their book.)
[ On Tuesday, December 17, 2002 at 18:56:41 (-0600), Andy Isaacson wrote: ]
> Subject: Re: bin/19381: netstat shows negative percentage
> The compiler can generate any machine opcodes it wants, so long as the
> result is correct according to the abstract specification of the
> standard. But the answer is not open to dispute.
Greg A. Woods
+1 416 218-0098; <firstname.lastname@example.org>; <email@example.com>
Planix, Inc. <firstname.lastname@example.org>; VE3TCP; Secrets of the Weird <email@example.com>