[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ANN] Lua 5.2.0 (rc2) now available
- From: Patrick Donnelly <batrick@...>
- Date: Mon, 28 Nov 2011 14:20:32 -0500
On Mon, Nov 28, 2011 at 12:51 PM, Roberto Ierusalimschy
>> Roberto Ierusalimschy <email@example.com> 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
> < exit(status);
>> if (L) exit(status); /* test to avoid warnings of 'exit' x 'return' */
>> return 0;
I think this would be foolproof:
if (lua_isnumber(L, -1)) exit(status);
- Patrick Donnelly