[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: [ANN] Lua 5.3.0 (beta) now available
- From: "Newman, Edward (iLO Firmware)" <Edward.Newman@...>
- Date: Thu, 23 Oct 2014 20:16:13 +0000
VC8. I will defend neither the intelligence nor the wisdom of the compiler, nor would I have chosen it.
Casting the expression to (char) (1.) should be harmless since buff is of type char *, and (2.) makes the warning go away.
It's just a request.
--EN
> -----Original Message-----
> From: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org] On
> Behalf Of Sean Conner
> Sent: Thursday, 23 October, 2014 14:59
> To: Lua mailing list
> Subject: Re: [ANN] Lua 5.3.0 (beta) now available
>
> 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?