lua-users home
lua-l archive

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


lua_assert macro definition seems a bit confusing:

In lua_lib.h:

#if !defined(lua_assert)
#define lua_assert(x)   ((void)0)
#endif

But also in llimits.h

/* internal assertions for in-house debugging */
#if defined(lua_assert)
#define check_exp(c,e)          (lua_assert(c), (e))
/* to avoid problems with conditions too long */
#define lua_longassert(c)       { if (!(c)) lua_assert(0); }
#else
#define lua_assert(c)           ((void)0)
#define check_exp(c,e)          (e)
#define lua_longassert(c)       ((void)0)
#endif


And then again in ltests.h

/* turn on assertions */
#undef NDEBUG
#include <assert.h>
#define lua_assert(c)           assert(c)


I take it that the intention is that if ltests.h is included the
lua_assert() is defined as assert() - but otherwise it is defined as
((void)0)?

Also I am guessing that the definition in lualib.h is for external C
api users but the one in llimits.h is for internal usage?

Thanks and Regards
Dibyendu