lua-users home
lua-l archive

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

Mike Pall wrote:
Ok, this is a serious bug in Lua 5.1. It's only visible if
sizeof(int)*2 < sizeof(lua_Number). I.e. it probably only affects
16 bit CPUs with lua_Number defined as a double. But the original
assignments depend on a side-effect (full overlap) not guaranteed
by the standard (even on 32/64 bit CPUs).

But the fix bears the question: is union assignment part of C89?

Is the union necessary at all? The bunch of expdesc in the front-end doesn't look like it is a big memory hog. On x86, doing without a union increases the structure size from 20 bytes to 28 bytes. I don't think this will eat up a lot more memory...

In fact, all the expdesc declarations look like they are local to functions and are allocated on the stack. Once the source is compiled, the memory used by expdesc structures ceases to be a problem...

Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia