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:
> >
> > 277c277
> > <   exit(status);
> > ---
> > >   return (exit(status), 0);
> 
> That's an error because exit() doesn't return a value :-)
> 
> 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. So, some
compilers have the annotation and rightfully complain when there is a
return, and some do not have the annotation and rightfully (for their
knowledge) complain when there is no return.

Would this trick satisfy all compilers?

diff -r1.35 loslib.c
277c277,278
<   exit(status);
---
>   if (L) exit(status);  /* test to avoid warnings of 'exit' x 'return' */
>   return 0;


-- Roberto