lua-users home
lua-l archive

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





On 6 July 2013 09:38, Miles Bader <miles@gnu.org> wrote:
liam mail <liam.list@googlemail.com> writes:
> "In case of overflows in integer arithmetic, all operations wrap around,
> according to the usual rules of two-complement arithmetic."
>
> Usual rules of two complement arithmetic? Would some care to explain as in
> C signed ints do not wrap.

Well to be fair, it doesn't say "C signed ints," and the behavior of
twos-complement signed values are clear enough...

-miles

--
People who are more than casually interested in computers should have at
least some idea of what the underlying hardware is like.  Otherwise the
programs they write will be pretty weird.  -- Donald Knuth


Erm thanks Miles.
The code is written in C so this is why I am asking what the usual rules are as that specific operation in C is undefined, hence it is not normal. So if you would not mind explaining what the normal operation is and point me to where Lua's C code detects this illegal overflow and prevents it before the undefined behaviour happens that would be so kind and more constructive.

--Liam