lua-users home
lua-l archive

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


> The trick with 0-... seems to work:
In fact, 0u - ... would be a little better than 0 - ...

Now that I am rebuilding my application, I also remember two other
small build issues, which were already present in 5.2.0 (alpha)

1) The macro twoto(x) defined as (1<<(x)) in lobject.h gives numerous
warnings when building on MSVC for 64 bits platforms.
The message is:
   warning C4334: '<<' : result of 32-bit shift implicitly converted
to 64 bits (was 64-bit shift intended?)
It can be corrected with a cast:

#define twoto(x)	((lua_Integer)1<<(x))

2) In lauxlib.h, functions luaL_pushmodule and luaL_openlib along with
macro luaL_register are declared whether or not LUA_COMPAT_MODULE is
defined.
This is not logical, because those functions are only implemented if
LUA_COMPAT_MODULE is defined.
On my build system, it even gives link errors because I have a Lua
script scanning header files and exporting the public functions !
So lauxlib.h should be:

/* compatibility with old module system */

#if defined(LUA_COMPAT_MODULE)
LUALIB_API void (luaL_pushmodule) (lua_State *L, const char *modname,
                                   int sizehint);
LUALIB_API void (luaL_openlib) (lua_State *L, const char *libname,
                                const luaL_Reg *l, int nup);

#define luaL_register(L,n,l)	(luaL_openlib(L,(n),(l),0))
#endif