lua-users home
lua-l archive

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

On Tue, Jul 9, 2013 at 6:37 AM, Roberto Ierusalimschy <> wrote:
> is Lua still write in the subset of C89 and C++03?

Yes. If you compile with LUA_ANSI defined, it will not use long long.

> but the issue is the integer wide of Lua: can Lua use different standard
> integer on different system?

Sure. The idea is that the default would be 64-64, but restricted systems
probably will prefer 32-32. (Moreover, systems with no 64-bit integers
at all can use either 32-32 or 32-64).

The 32-32 option is especially intriguing as most new "high end" (~$10) microcontrollers (such as STM32F4 and many others) have enough memory (64->256K SRAM) to run special Lua versions (e.g. eLua) and have 32-bit hardware floating point.  Embedded MCU/MPUs with 64-bit floating point are still very uncommon (I can only think of TI C67x DSPs, some Renesas SH & RX, and some PowerPC).  The ARM NEON only supports 32-bit floating point, along with 8/16/32/64-bit integers, so for ARM chips with NEON maybe 64-32 would be best.


Currently, the problem is even worse, as many people use Lua without
floating-point numbers. Mostly, we just ignore those uses (it is not
"official" Lua) and pretend the problem does not exist. We hope the
32-32 option will allow many programmers in embedded systems to have
a non-standard but officialy supported version of Lua, with 32-bit
integers for performance and floating-point numbers when necessary.

-- Roberto