lua-users home
lua-l archive

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


On Jul 8, 2013 9:15 AM, "Roberto Ierusalimschy" <roberto@inf.puc-rio.br> wrote:

[signed integer overflow]

> > > That may not do what is expected, because it involves
> > > implementation-defined behavior:
> > >
> > > 3.2.1.2 Signed and unsigned integers [...]  When an integer is
> > > demoted to a signed integer with smaller size, or an unsigned
> > > integer is converted to its corresponding signed integer, if the
> > > value cannot be represented the result is implementation-defined.
> >
> > If I remember right, you can work around this with a memcpy() from the
> > unsigned variable to the signed variable.
>
> Before trying to solve a problem, let us be sure there is a
> problem.

Yes. What problem is wrapping on signed integer overflow trying to solve?

Jay