lua-users home
lua-l archive

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


Roberto Ierusalimschy writes:
> > (2)
> >  int error = GetLastError();...
> > GetLastError returns instead a DWORD type, which is normally used[2].
> > Internally, DWORD is a "typedef unsigned long DWORD;" in windef.h
> > despite what the MSDN docs[3] say.
> 
> Should we declare error as DWORD?

It probably really doesn't matter in practice.  The error code gets converted
from unsigned to signed back to unsigned.  Furthermore, I doubt the sign bit is
ever set in practice (for such non-HRESULT error codes as noted in winerror.h
and HRESULT_FROM_WIN32).  It also doesn't generate any compiler warnings.

Here's a few more:

(8)

  if (L) lua_atpanic(L, &panic);
lauxlib.c(649) : Warning 546: Suspicious use of &

  status = lua_cpcall(L, &pmain, &s);
lua.c(387) : Warning 546: Suspicious use of &

"...the use of the & [on a function name] is redundant and could be erroneous."

(9)

Info 759: header declaration for symbol 'luaD_seterrorobj(struct lua_State *,
    int, struct lua_TValue *)' defined at (line 51, file ldo.c) could be moved
    from header to module
Info 765: external 'luaD_seterrorobj(struct lua_State *, int, struct lua_TValue
    *)' (line 51, file ldo.c) could be made static

Info 759: header declaration for symbol 'luaG_checkopenop(unsigned int)'
    defined at (line 290, file ldebug.c) could be moved from header to module
Info 765: external 'luaG_checkopenop(unsigned int)' (line 290, file ldebug.c)
    could be made static

Info 759: header declaration for symbol 'luaX_tokens' defined at (line 37, file
    llex.c) could be moved from header to module
Info 765: external 'luaX_tokens' (line 37, file llex.c) could be made static

These functions could be made static, though there could be reasons to keep them
external.