lua-users home
lua-l archive

Re: os.date & MS Windows XP CRT

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


David Burgess wrote:
> Does not happen for my Lua build maybe the following
> helps
>
> http://www.lua.org/bugs.html
>
> I have compiled the patched lua5.1.1 with
>
> vc6/vc7/vc8
>
> No problems on XP SP2.
>
> db
Thanks. Very strange. I've compiled the test-case below with the following compiler version (same as my Lua build): Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.42 for 80x86
And it still crashes on %c. Wondering what exactly is crashing :?
Sorry for the noise if this turns out to be a non-issue. Though I still suggest adding a minimal supported subset to the manual under os.date if possible (from the C standard Mark Edgar linked to? (thanks!)).
 - Peter
#include <windows.h>
#include <stdio.h>
#include <time.h>
int main(int argc, char ** argv)
{
 time_t now;
 struct tm *today;
 char buffer[1024];
 time(&now);
 today = localtime(&now);
 /* to verify the arguments are valid */
strftime(buffer, sizeof(buffer), "Today is %A, day %d of %B in the year %Y.\n", today);
 printf("%s", buffer);
 /* CRASH :-\ */
 strftime(buffer, sizeof(buffer), "%e...", today);
 printf("%s", buffer);
 return 0;
}
/* cl /TC /D_CRT_SECURE_NO_DEPRECATE test.c */
/* I guess this kind of stuff is the reason they deprecated it :P */

AltStyle によって変換されたページ (->オリジナル) /