lua-users home
lua-l archive

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


On Wed, Jun 24, 2015 at 3:04 PM, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
> When building Lua 5.3.1 on OS X with LLVM, I get the following warning:
>
> lua/src/lvm.c:1128:58: warning: implicit conversion loses integer
> precision: 'long' to 'int' [-Wshorten-64-to-32]
>
>         b = luaD_poscall(L, ra, (b != 0 ? b - 1 : L->top - ra));
>
>             ~~~~~~~~~~~~                          ~~~~~~~^~~~
>
> This should be trivially fixable by casting L->top - ra to int.
>
> IMHO this is worth doing because it's being implicitly converted anyway,
> and it's the only warning produced by the build :)

It is funny that this compiler flags only this one. If I use
-Wconversion in my platform, I get 226 warnings similar to this one.

When building x64 executables of Lua 5.3.1 using MS Visual Studio the following 2 warnings are displayed:

lstrlib.c(839) : warning C4267: 'return' : conversion from 'size_t' to 'int', possible loss of data
lvm.c(1128) : warning C4244: 'function' : conversion from '__int64' to 'int', possible loss of data

-- Egor