lua-users home
lua-l archive

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

> > We cannot put the call inside the assert, so we need to assign
> > the return to a variable and assert on that variable. But without
> > assertions, we get a "unused variable" warning (and a weird code).  Then
> > we add a "(void)var" to avoid the warning, and get weirder code.  All in
> > all, the current assertion documents what we want and keeps the regular
> > code simple. (After all, if the assertion holds, its code is correct ;-)
> You're claiming the converse of the assertion, not the contrapositive.

Of course I am. The ";-)" in that message has a meaning...

> [...]  What is wrong a construction like:
> ```c
> if (VVOID == singlevaraux()) {
>  lua_assert(0 && "Error Message");
> }
> ```

It is (very) weird :-) It adds code outside an assertion only to make an
assertion. Some compiler could (with reason) give a warning about
these useless (and weird) comparison/test when assertions are off.

-- Roberto