lua-users home
lua-l archive

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


> lstrlib.c:192: warning: unknown conversion type character `'' in format
> Looks like this line should rather read:
>          luaL_error(ms->L, "malformed pattern (ends with `%%')");

Thanks!


> I'm not sure about the "noreturn" attribute to luaL_error(): Can this
> function ever return?

No, it never returns. (There are others: lua_error, luaL_typerror,
luaL_argerror, ...) However, we usually mark these functions as
returning integers and use a trick of writing "return luaL_error ..."
(in functions that return integral values). This trick avoids a "control
reaches end of non-void function" warning and, in most compilers, it
also allows better code generation, because the "return" removes the
path from this call to the rest of the function.

The "noreturn" attribute is much cleaner, but it only works in gcc and
it is incompatible with a function returning int.

-- Roberto