[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Re: [Tinycc-devel] fib.c
From: |
Dave Dodge |
Subject: |
Re: Re: [Tinycc-devel] fib.c |
Date: |
Fri, 16 Mar 2007 14:03:36 -0500 |
User-agent: |
Mutt/1.5.12-2006-07-14 |
On Fri, Mar 16, 2007 at 12:46:58PM -0700, Laszlo Hars wrote:
> Your code and this one relies on the "wrap-around at overflow" behavior
> of the compiler. I did not find it documented. Have I missed it?
C99 6.2.5 p9:
[...] A computation involving unsigned operands can never overflow,
because a result that cannot be represented by the resulting
unsigned integer type is reduced modulo the number that is one
greater than the largest value that can be represented by the
resulting type.
Note however that the overflow semantics for signed integer types are
undefined. In fact integer overflow is what the Standard uses as its
example of undefined behavior in the definition of terms section.
-Dave Dodge