[cfe-dev] [PATCH] Libc++ Windows fixes (Attention all libc++ ports!!!)

Howard Hinnant hhinnant at apple.com
Mon Sep 26 09:42:12 PDT 2011


On Sep 26, 2011, at 12:30 PM, Joerg Sonnenberger wrote:

> On Mon, Sep 26, 2011 at 10:02:22AM -0400, Howard Hinnant wrote:
>> I believe it does the right thing, presuming you have uselocale that
>> sets the per-thread locale to __l.
> 
> Does libc++ really depend on the crappy idea of per-thread locale?

libc++ depends on the existence of functions such as:

int
   sprintf_l(char * restrict str, locale_t loc, const char * restrict format, ...);

which are always called with the "C" locale passed to "loc".  These functions exist on OS X, and have recently been implemented on FreeBSD.  One way of emulating them is using a per-thread locale.

In a nutshell, libc++ needs to be able to get the functionality of sprintf, but using the "C" locale instead of the current global or per-thread locale.  And ditto for several other C I/O functions.

Howard




More information about the cfe-dev mailing list