[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: "noreturn" attribute in lua_error & Co
- From: Rena <hyperhacker@...>
- Date: Wed, 18 Apr 2012 23:31:23 -0600
On Wed, Apr 18, 2012 at 10:31, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
>> A second question arises: is there any benefit to write 'return
>> lua_error(L)' instead of just 'lua_error(L)' ?
>
> We hope there is. It gives the compiler the same kind of information
> that 'noreturn' gives, namely that the function will not continue
> executing after 'lua_error' was called.
It's also beneficial to the programmer for the same reason. Adding an
explicit 'return' makes it harder to miss the exit point when looking
over the code.
--
Sent from my toaster.