lua-users home
lua-l archive

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


> When compiling with the command line compiler of Visual Studio 10
> Express, I get the following warning:

Warnings from Visual Studio always make me sad :(


> ...\lua-5.2.2\src\lgc.c(453) : warning C4334: '<<' : result of 32-bit
> shift implicitly converted to 64 bits (was 64-bit shift intended?)

How can we answer "no, it was not"?

Does this solve it?

-                        sizeof(Node) * sizenode(h);
+                        sizeof(Node) * (int)sizenode(h);

Or maybe this?

-                        sizeof(Node) * sizenode(h);
+                        sizeof(Node) * (size_t)sizenode(h);


> And when linking (despite the Cxxxx code, I use /LTCG) I get this warning:
> 
> ...\lua-5.2.2\src\loadlib.c(187) : warning C4700: uninitialized local
> variable 'buffer' used

Let us see:

  char buffer[128];
  if (FormatMessageA(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM,
      NULL, error, 0, buffer, sizeof(buffer)/sizeof(char), NULL))
    lua_pushstring(L, buffer);

MS documentation says 'buffer' is an _Out_ parameter [1]. What can we do?


[1] http://msdn.microsoft.com/en-us/library/windows/desktop/ms679351%28v=vs.85%29.aspx


-- Roberto