thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Falsig <si...@newtec.dk>
Subject SV: Thrift C++ library generating locale-specific JSON
Date Tue, 02 Dec 2014 15:11:09 GMT
> Hi,
>
> How it should look (and hopefully work):
>
> char* oldLoc = setlocale(LC_NUMERIC, "C") std::stirng numberAsString = /*
> printf/lexical_cast/iostream */; setlocale(LC_NUMERIC, oldLoc);
>
> Preferably - some RAII construct has to be implemented :)
>
> It's probably only portable solution. But: setlocale can be sloooow, so
> maybe changing it once at begin of generation and restoring at end will
> be needed (local changes are better, yet I don't know what are efficiency
> expectations for code generator).
>
> -KG

Hmm - I'd really prefer not to have to change the locale for anything but
the conversion. We have multiple threads running in parallel, and it's not
possible to say if one of those is trying to get a localized version of a
string at the same time as the locale is changed... Of course, the risk
would probably not be huge, but it's still there...

For reference, I've created an issue in the Jira system now - it can be
found here: https://issues.apache.org/jira/browse/THRIFT-2870

Thanks,
 - Simon

Mime
View raw message