[cfe-dev] [PATCH] Libc++ Windows fixes
csdavec at swan.ac.uk
Fri Sep 23 11:40:17 CDT 2011
On 23 Sep 2011, at 17:30, Howard Hinnant wrote:
> But I agree that the *named* locale facility could use optimization, even when the name is "C". But this is a very tricky area. Please post non-trivial code for review prior to committing.
Absolutely. The global "C" locale, and a named "C" locale are different in xlocale, since the locale_t contains some state used by the various multibyte functions.
Does the classic locale refer to the "C" locale, or the current global locale? If it's the former, then it DOES need to be allocating memory (although in libc, not in libc++). If it's the latter, then you have to be very careful with it because using the global locale from multiple threads is not safe (on FreeBSD or Darwin) if you call any of the mbs* functions. You need to call duplocale() on the global locale if this is what you want, and have an instance of it for each thread.
More information about the cfe-dev