Re: MSEC_TO_JIFFIES is messed up...
From: Paul Wagland
Date: Sun May 16 2004 - 07:14:32 EST
On May 16, 2004, at 5:48, Chris Wedgwood wrote:
On Wed, May 12, 2004 at 11:55:18PM +0200, Andreas Schwab wrote:
Signed integer overflow is undefined in C, so the compiler is
allowed to assume it does not happen.
Really?
Just because something is undefined assuming it never happens is a bit
of a leap of faith IMO.
More precisely, if something has undefined semantics then the compiler
is allowed to do whatever it likes. Normally the compiler will try to
do "what's right", but if they have an optimisation opportunity then
they will normally take it.
In other words by assuming it "doesn't happen" they get to perform an
optimisation that they could not do otherwise, and they get to perform
"correctly" in an undefined way when the overflow would happen.
Cheers,
Paul
Attachment:
PGP.sig
Description: This is a digitally signed message part