lua-users home
lua-l archive

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



On 23/10/14 05:58 PM, Sean Conner wrote:
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?

I think signedness is a word... (don't ask me tho, idk)