tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] fib.c


From: Rob Landley
Subject: Re: [Tinycc-devel] fib.c
Date: Fri, 16 Mar 2007 16:38:20 -0400
User-agent: KMail/1.9.1

On Friday 16 March 2007 3:03 pm, Dave Dodge wrote:
> 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.

Um, query:

Should any of these be checked in to replace the example (or added as a better 
example), or does it matter...?

(All I maintain is my rampantly unofficial hg tree, which will diverge from 
mainline horribly if I ever get back to spending time on it and breaking 
tcc.c up into several smaller files and moving windows host support into the 
win32 directory and so on, but I'm still curious...)

Rob
-- 
Vista: Windows Millenium Second Edition




reply via email to

[Prev in Thread] Current Thread [Next in Thread]