lua-users home
lua-l archive

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


> I got an error compiling lua 5.1.4 with IBM XL for AIX (unknown
> version), under AIX Version 6, using C++ and LUA_USE_POSIX (not that
> it matters).
> 
> "[...]/src/loslib.cpp", line 222: Error: "os_exit(lua_State*)" is
> expected to return a value.
> 1 Error(s) detected.

This is a bug in the compiler. ISO/IEC 9899:1999 (E) does not require
that a function with a return type actually returns any value, unless
the returned value is actually used:

  ISO/IEC 9899:1999 (E), Section 6.9.1:

  If the } that terminates a function is reached, and the value of the   
  function call is used by the caller,the behavior is undefined.          


The other restrictions about returns are these:

  Section 6.8.6.4:

  A return statement with an expression shall not appear in a function    
  whose return type is void. A return statement without an expression     
  shall only appear in a function whose return type is void.              
  [...] A function may have any number of return statements.

-- Roberto