lua-users home
lua-l archive

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


Roberto Ierusalimschy wrote:
> 
> > F:\Languages\lua-5.0-work0\src\lib\liolib.c(579) : warning C4702:
> > unreachable code
> 
> The code is
> 
>   exit(luaL_opt_int(L, 1, EXIT_SUCCESS));
>   return 0;  /* to avoid warnings */
> 
> If we put the "return", some compilers complain. If we do not, others
> complain. Does anyone knows a solution?

Try this one:

  if (L) /* always true - 1st step to avoid warnings */
    exit(luaL_opt_int(L, 1, EXIT_SUCCESS));
  return 0;  /* 2nd step to avoid warnings */

Ciao, ET.


PS: The usual way to define blocks in macros (i.e. in setnvalue,
setpvalue, ...) is to use "do { ... } while (0)".