lua-users home
lua-l archive

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


Ok, I see. So it's a problem with the OS code. I'll let them know they're using a wrong assert definition. Thank you :-)


2013/11/12 Roberto Ierusalimschy <roberto@inf.puc-rio.br>
> [...]
>
> 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