lua-users home
lua-l archive

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


----- Original Message -----
From: Roberto Ierusalimschy
Date: 3/15/2013 6:42 AM

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


Generally, you can rid Visual Studio of this error by doing something like:

  char buffer[128];
+  buffer[0] = 0;
  if (FormatMessageA(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM,


-Josh