lkml.org 
[lkml]   [2004]   [May]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: MSEC_TO_JIFFIES is messed up...
Date

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
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-03-22 14:03    [W:1.607 / U:0.404 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site