lua-users home
lua-l archive

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


Hi,

Greg Falcon wrote:
> IMO, Lua really ought to be fixed to use catch(struct lua_longjmp)
> rather than catch(...), since lua_longjmp is the only type of object
> Lua will throw.  Lua has no business catching other exceptions. 
> Better to let unhandled exceptions remain unhandled.

But then Lua can't restore its own state. See the (status != 0)
cases in LuaD_pcall or lua_resume. So a catch(...) may be ugly,
but at least it doesn't screw up the Lua state (with the
LUA_ERREXC bug fix of course).

BTW to Roberto: I assume the LUA_ERREXC bug fix will be part of
Lua 5.1.1-rc1?

> The Resumable VM patch is not quite 100% portable ANSI C yet, as it
> assumes an int can be stored in a void* and retrieved as an int later.
>  The C standard says casting an int to void* can generate a trap
> representation (6.3.2.3 p5) which can cause undefined behavior later
> when the void* ctx is read (6.2.6.1 p5).

Well, you could work around this by using a union instead of a
void* everywhere. But I seriously doubt there is a platform still
in common use with this behaviour. It would be quite esoteric,
anyway.

Bye,
     Mike