lua-users home
lua-l archive

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


> > > lobject.c:327:5: warning: format '%d' expects argument of type 'int', but argume
> > > nt 3 has type 'lua_Integer' [-Wformat=]
> > >      len = lua_integer2str(buff, ivalue(obj));
> > >      ^
> > > [...]
> > > liolib.c:612:17: warning: format '%d' expects argument of type 'int', but argume
> > > nt 3 has type 'lua_Integer' [-Wformat=]
> > >                  ? fprintf(f, LUA_INTEGER_FMT, lua_tointeger(L, arg))
> > >                  ^
> > > [...]
> > > luac.c:269:2: warning: format '%d' expects argument of type 'int', but argument
> > > 2 has type 'lua_Integer' [-Wformat=]
> > >   printf(LUA_INTEGER_FMT,ivalue(o));
> > >   ^
> > > [...]

Thijs and I figured out the problem. TDM64 (and maybe other gcc
compilers for Windows) does not recognize Windows-specific options in
formats (such as '%I64d') and handles them incorrectly. Despite the
warnings, the compiler generates correct code.

One solution would be to use ISO standard stuff to handle 64-bit
integers (long long, %lld, LLONG_MAX), instead of Windows-specific
stuff (__int64, %I64d, _I64_MAX). At least in my test box (VS 2010), that
works, but I am not sure about other Windows. (In particular, I could
not find anything about LLONG_MAX in Microsoft documentation.) For now,
we will leave at it is.

-- Roberto