lua-users home
lua-l archive

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


> (2)
> 
> The following code in loslib.c causes warnings under MSVC2005 -W4:
> 
>   static int os_exit (lua_State *L) {
>     exit(luaL_optint(L, 1, EXIT_SUCCESS));
>     return 0;  /* to avoid warnings */
>   }
> 
> $ cl -nologo -D_CRT_SECURE_NO_WARNINGS -c -W4 src/loslib.c loslib.c
> u:\tmp\lua-5.1.3\src\loslib.c(218) : warning C4702: unreachable code

Can you try this trick?

  static int os_exit (lua_State *L) {
    return (exit(luaL_optint(L, 1, EXIT_SUCCESS)), 0);  /* avoid warnings */
  }


-- Roberto