lua-users home
lua-l archive

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


> [...]
> 
> In the end, that line (and some others in that file) is replaced by
> something like this:
> 
> CClosure *func = (lua_assert(ttisCclosure(o)), &val_(ci->func).gc->cl.c)
> 
> The idea is that you force an assertion but only make an assignment of the
> right side of the parenthesis expression. The problem is "lua_assert",
> AFAIK, it's supposed to be replaced by an OS dependent version (Lua defines
> it void), which in many cases is a macro that looks like this:
> 
> #define OS_ASSERT do { /*STUFF*/ } while(0)

The ISO standard says that about assert:

  7.2.1.1 The assert macro

  Synopsis
    #include <assert.h>
    void assert(scalar expression);

Description

  The assert macro puts diagnostic tests into programs; it expands to a
  void expression.

A do while loop is not an expression; therefore, such definition for
assert is invalid according to the standard.

-- Roberto