[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Issues with check_exp implementation
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 13 Nov 2013 09:19:48 -0200
> I think you meant that "#define lua_assert(x) assert(x)" is all I need?
>
> Just defining LUA_USE_APICHECK does not change lua_assert() at all, and if I only define LUA_USE_APICHECK then lua_assert(0) does not cause an assertion. However, if I remove the LUA_USE_APICHECK define but do define lua_assert() then luai_apicheck() will also assert. :)
I think there are two different things here. LUA_USE_APICHECK does not
need lua_assert, as it defines luai_apicheck using assert directly. As
its name implies, it checks only the API, not Lua internals. (Usually
this is what people want.) However, if you are hacking the *insides* of
the Lua kernel, then it may be worth defining lua_assert. You can also
consider using ltests.h/ltests.c (distributed with the test files),
which defines lua_assert and some other checks (e.g., a basic allocator
check).
-- Roberto