[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ANN] Lua 5.2.0 (rc2) now available
- From: Tony Finch <dot@...>
- Date: Mon, 28 Nov 2011 18:17:47 +0000
Roberto Ierusalimschy <firstname.lastname@example.org> 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... ]
f.anthony.n.finch <email@example.com> 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.