Hi,
I just found this piece of code in the scriptstdstring addon:
// WinCE doesn't have setlocale. Some quick testing on my current platform
// still manages to parse the numbers such as "3.14" even if the decimal for the
// locale is ",".
#if !defined(_WIN32_WCE) && !defined(ANDROID) && !defined(__psp2__)
// Set the locale to C so that we are guaranteed to parse the float value correctly
char *orig = setlocale(LC_NUMERIC, 0);
setlocale(LC_NUMERIC, "C");
#endif
double res = strtod(val.c_str(), &end);
#if !defined(_WIN32_WCE) && !defined(ANDROID) && !defined(__psp2__)
// Restore the locale
setlocale(LC_NUMERIC, orig);
#endif
But, this seems to be invalid code, since the second setlocale call will invalidate the first "orig" pointer, as described on MSDN: https://msdn.microsoft.com/en-us/library/x99tb11d.aspx
QuoteYou can copy the string returned by
setlocale
to restore that part of the program's locale information. Global or thread local storage is used for the string returned bysetlocale
. Later calls tosetlocale
overwrite the string, which invalidates string pointers returned by earlier calls.