Menu

#103 QtSpim on Linux uses user locale to parse sources, breaking floating point constants parsing

v1.0_(example)
closed
nobody
None
1
2022-03-15
2022-03-02
MItaly
No

QtSpim on Linux fails to parse correctly floating point values in assembly sources if the system locale is set to anything that doesn't use . as decimal separator (e.g. it-IT locale, which uses ,). That's because QApplication only on Unix systems calls setlocale(LC_ALL, ""); inside the constructor, and that affects how all standard C functions (such as sscanf, atof, strtod, ...) parse numbers.

This is a well-known gotcha, documented even in Qt docs; the solution suggested there is to do a setlocale(LC_NUMERIC, "C"); immediately after the QApplication construction; if you ask me, at least for coherency with the builds done in other platforms, a better idea is to be more radical and reset everything back to default (setlocale(LC_ALL, "C");).

Discussion

  • James Larus

    James Larus - 2022-03-15
    • status: open --> closed
     
  • James Larus

    James Larus - 2022-03-15

    Yes, that's silly that they documented it and didn't fix it.

     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB