[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.3.0 (beta) now available
- From: Sean Conner <sean@...>
- Date: Thu, 23 Oct 2014 15:58:54 -0400
It was thus said that the Great Roberto Ierusalimschy once stated:
>
> > [...]
> > lstrlib.c, line 1142. Change:
> > buff[islittle ? i : size - 1 - i] = (n & MC);
> > To:
> > buff[islittle ? i : size - 1 - i] = (char)(n & MC);
> > Explanation: Prevents compiler warning about possible loss of data.
>
> This compiler seems quite dumb :-) How can (n & 0xFF) loose data??
Being charitable [1], *technically* you are potentially losing
information---values 128 to 255 may become -128 to -1, if chars are signed
[2].
-spc (Or it could be an utterly stupid compiler)
[1] Like Microsoft needs any charity
[2] C standard leaves the signness [3] of a bare 'char' declaration up
to the implementation---it can be either signed or unsigned.
[3] Is that even a word?