Skip to content

Commit 1e6b01c

Browse files
MinGW: Work around lack of strtof_l for locale independent parsing (#1697)
Signed-off-by: L. E. Segovia <[email protected]> Signed-off-by: L. E. Segovia <[email protected]> Co-authored-by: Doug Walker <[email protected]>
1 parent e7a88bf commit 1e6b01c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/utils/NumberUtils.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,12 @@ really_inline from_chars_result from_chars(const char *first, const char *last,
9999

100100
float
101101
#ifdef _WIN32
102+
#if defined(__MINGW32__) || defined(__MINGW64__)
103+
// MinGW doesn't define strtof_l (clang/gcc) nor strtod_l (gcc)...
104+
tempval = static_cast<float>(_strtod_l (first, &endptr, loc.local));
105+
#else
102106
tempval = _strtof_l(first, &endptr, loc.local);
107+
#endif
103108
#elif __APPLE__
104109
// On OSX, strtod_l is for some reason drastically faster than strtof_l.
105110
tempval = static_cast<float>(::strtod_l(first, &endptr, loc.local));

0 commit comments

Comments
 (0)