lua-users home
lua-l archive

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


Well, another solution may be to introduce an unsigned type with bit
wise operators besides arithmetic operators aiming at representing
addresses and accepting hexadecimal literals only... 
I would be really happy with that.
This would also allow simplifying literal support for current number,
and this address type could be also optional in luaconf.h for those not
willing to pay the overhead of a new type.

-----Original Message-----
From: lua-bounces@bazar2.conectiva.com.br
[mailto:lua-bounces@bazar2.conectiva.com.br] On Behalf Of Jerome Vuarand
Sent: Wednesday, November 15, 2006 12:37 AM
To: Lua list
Subject: RE: lua_number2int

Asko Kauppi wrote:
> Me, yesterday, 14:21
> 
> > Also "lua_tounsigned()" would be handy.
> 
> :)  imho, the whole integer support should be revised.

Maybe the best solution is to remove completely integer support. Keep
one type to contain them all. No more lua_Integer or lua_tointeger. Keep
Lua high level and let the user convert the doubles to whatever fits the
C code. tointeger/tounsigned are easy to write above tonumber. As the
thread as shown, default ones are error prone, may cross C definition
boundaries and lead to undefined behaviour (and daemons invasions :-) ).