[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.3.0 (work1) now available
- From: Roberto Ierusalimschy <roberto@...>
- Date: Mon, 8 Jul 2013 10:15:04 -0300
> > 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. Have anyone ever used a C implementation where the conversion
from unsigned int to int did not have the "expected" behavior (keep the
bits unchanged)?
-- Roberto