lua-users home
lua-l archive

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


> By changing three lines from the distribution, Lua 5.2.0 can build
> without warnings on all these 7 tool chains.

Many thanks for the tests and suggestions.


> 3) lobject.h, line 571
> < #define twoto(x)	(1<<(x))
> > #define twoto(x)	((lua_Integer)1<<(x))
> 
> I had already signaled that problem before. Without the extra (and in
> fact useless) cast, [...]
> result of 32-bit shift implicitly converted to 64 bits (was 64-bit
> shift intended?)

The problem is that this cast is not completely useless.  In 32-bit
machines with lua_Integer defined as long long, the compiler will
generate more expensive code for nothing.  Moreover, we want to shift
an 'int'. We do not want to shift 64 bits, despite what the compiler
thinks.  Isn't there any way to indicate that fact in the code so that
it will not generate warnings?

-- Roberto