LUA_NUM_TYPE=long

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

LUA_NUM_TYPE=long

Vincent PENQUERC'H

   Hi,

I compiled Lua with LUA_NUM_TYPE as long (change was made
in the config file).
It compiled, but I have a big bunch of warnings (conversion
between double and long). There are many places in Lua that
show hard coded uses of doubles, mainly (this is where this
annoys me) the return type of the lua_getnumber,
lua_pushnumber, etc functions.
Is the LUA_NUM_TYPE support in the process of being finalized,
or is it obsolete, or does it only apply to Lua's internal
processings ?


Vincent Penquerc'h

"4 GB ought to be enough for anybody."


Reply | Threaded
Open this post in threaded view
|

RE: LUA_NUM_TYPE=long

Vincent PENQUERC'H
> I compiled Lua with LUA_NUM_TYPE as long (change was made
> in the config file).
> It compiled, but I have a big bunch of warnings (conversion
> between double and long). There are many places in Lua that

I reread this and noticed I forgot an important detail:
Actually, the warnings are in my code, when I try to pass
integers to the lua_pushnumber function for instance, as
lua_pusnumber expects a double even when LUA_NUM_TYPE is
set to long.


Vincent Penquerc'h

"4 GB ought to be enough for anybody."

Reply | Threaded
Open this post in threaded view
|

Re: LUA_NUM_TYPE=long

Roberto Ierusalimschy
In reply to this post by Vincent PENQUERC'H
> Is the LUA_NUM_TYPE support in the process of being finalized,
> or is it obsolete, or does it only apply to Lua's internal
> processings ?

I would mark the last option. The idea is: "official" Lua uses double; but 
it is also part of the main idea behind Lua to be open enough so that you 
can change whatever you need/want for your specific needs. So, LUA_NUM_TYPE 
tries to make easier the task to change the "number" type in Lua, and it 
takes the bulk of the work; but if you want a clean and elegant final 
language with longs, you'd better put your hands on the code. 

-- Roberto

Reply | Threaded
Open this post in threaded view
|

RE: LUA_NUM_TYPE=long

Vincent PENQUERC'H
In reply to this post by Vincent PENQUERC'H
> I would mark the last option. The idea is: "official" Lua 
> uses double; but 
> it is also part of the main idea behind Lua to be open enough 
> so that you 
> can change whatever you need/want for your specific needs. 
> So, LUA_NUM_TYPE 
> tries to make easier the task to change the "number" type in 
> Lua, and it 
> takes the bulk of the work; but if you want a clean and elegant final 
> language with longs, you'd better put your hands on the code. 
> 

Noted. I think I will tweak the headers and whatever needs to be.
I dislike warnings in my code :)
Thanks for the advice, Roberto


Vincent Penquerc'h

Reply | Threaded
Open this post in threaded view
|

Re: LUA_NUM_TYPE=long

David Jeske-3
On Fri, May 28, 1999 at 04:18:02AM -0300, Vincent PENQUERC'H wrote:
> Noted. I think I will tweak the headers and whatever needs to be.
> I dislike warnings in my code :)
> Thanks for the advice, Roberto

FWIW, I needed an "unsigned long" version of lua and had to do the
same thing. :)

-- 
David Jeske (N9LCA) + http://www.chat.net/~jeske/ + [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: LUA_NUM_TYPE=long

Vincent PENQUERC'H
In reply to this post by Vincent PENQUERC'H
> 
> FWIW, I needed an "unsigned long" version of lua and had to do the
> same thing. :)

I jumped into the code, and found out what to change. It works very
well. I just had to change the 'double' 's in a few headers and their
respective C files, as well as moving ID_NUMBER to ID_INT4 (if I recall
well, that was all). That 'grep LUA_NUMBER' idea is a real time saver :)
All was done real quick !
Did you spot anything else you had to change and I could have left out ?
The thing I was not sure about was formatting ... Lua formats numbers as
%g, and it's in the docs, so I left this out ... Since it formats long's
OK...

Vincent Penquerc'h