lua-users home
lua-l archive

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


>>>>> "Luiz" == Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> writes:

 Luiz> Lua 5.3.5 fixes all bugs listed in http://www.lua.org/bugs.html#5.3.4 .

So a question that comes to mind is this: why is there no sane way for
the host program to detect the Lua minor version either at compile time
or runtime? In my code I have to expend a _lot_ of effort on a
workaround for one of the 5.3.4 bugs, but there's no good way for me to
detect whether I'm actually building against 5.3.5 in order to skip
doing that.

(The only record of the minor version seems to be LUA_VERSION_RELEASE,
which is a string and not a number so it can't be used for conditionals
without doing ugly makefile tricks.)

What I _want_ to be able to do is something like:

#if LUA_VERSION_NUM == 503 && LUA_VERSION_RELEASE_NUM < 5
#define USE_BUG_WORKAROUND
#endif

and later,

#ifndef USE_BUG_WORKAROUND
    int lua_ver = lua_version_release(L);
    /*
     * if we're not using the workaround, check that we don't have the
     * bug.
     */
    if (lua_ver >= 50303 && lua_ver < 50305)
        luaL_error(L, "Recompile with correct lua version");
#endif

But without minor version checks, I'm stuck having to use the workaround
all the time whether it's really needed or not.

-- 
Andrew.