lua-users home
lua-l archive

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


Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:

> > I think in this case the compiler is wrong to produce the warning. Good
> > implementations have an annotation on exit() to say it never returns.
> > This is not a bug in Lua.
>
> The problem here is that this kind of annotation is not ANSI.

You are right, but I wasn't clear. The missing annotation should be on the
declaration of exit() inside the system headers, which is why I say it's a
bug in the compiler+library not in Lua.

> Would this trick satisfy all compilers?

I think it will at the moment.

[ Rambling aside: There's a slight risk that a clever compiler might spot
that L cannot be NULL and that the return statement is unreachable. But
usually "cannot be NULL" is implied by the pointer being visibly
dereferenced, and all the dereferences are inside Lua API function calls
so are not visible to the compiler. But that would no longer be the case
if (say) lua_type became a macro... ]

Tony.
-- 
f.anthony.n.finch  <dot@dotat.at>  http://dotat.at/
Trafalgar: Northerly 4 or 5, backing westerly 5 or 6 in north Trafalgar and
southeast Fitzroy later. Moderate or rough. Fair. Good.