Menu

#9 better fix for formatting floats in C locale

open
nobody
None
5
2007-06-18
2007-06-18
No

This patch does the same thing as the patch 1223177 except better: using localeconv() as the other patch does is unsafe in multithreaded applications as the pointer returned by it may become invalid between localeconv() call and the point where we use it if setlocale() was called in the meanwhile in another thread.

Also, using std::stringstream is easier and more clear than all these #ifs anyhow. And it could be trivially adapted to Unicode build mode by using wstringstream (I don't submit this in my patch because I don't have a version with Unicode support here).

Discussion

  • Vadim Zeitlin

    Vadim Zeitlin - 2007-06-18

    patch to dtconv.h

     
  • Vadim Zeitlin

    Vadim Zeitlin - 2009-10-17

    Patch replacing swprintf/strtod with C++ streams use

     
  • Vadim Zeitlin

    Vadim Zeitlin - 2009-10-17

    Updated patch for 0.2.5. Also included (albeit untested) Unicode support.

    TIA for any comments.

     

Log in to post a comment.