lua-users home
lua-l archive

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




2009/12/13 liam mail <liam.list@googlemail.com>


2009/12/13 liam mail <liam.list@googlemail.com>



2009/12/13 Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br>

> So you are saying that a configure script which sets up Lua before compiling
> the library and does not check that types are large enough to pass a
> standard type and retrieve the same type is not a bug?

Lua does not use a configure script. There is no automatic setup.
Lua uses a config header file that you're supposed to check and edit
to suit your platform. The relevant section in luaconf.h is

I apologise, I just take it for granted that most libraries use configure scrips. sorry.
/*
@@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger.
** CHANGE that if ptrdiff_t is not adequate on your machine. (On most
** machines, ptrdiff_t gives a good choice between int or long.)
*/
#define LUA_INTEGER     ptrdiff_t

I guess the comment should make it clear that LUA_INTEGER should limit
integers to what can be stored without loss in a LUA_NUMBER.

A make test that failed would be nice, so that when building we knew there was a problem. I would not expect many people actually run there own tests to see if the defaults are good enough.

What do you suggest I change LUA_INTERGER to? ptrdiff_t is the same size as long which is the largest possible standard integer type. Should it be long double as suggested?

Actually long long is valid C99 is it not? Although would this cause problems when used in a C++ library as there is no long long in that Language.

Please ignore this long long is only guaranteed to have at least 64 bits and the problem is with the double.