[SERVER-41547] convert strtod to std::from_chars to support StringData Created: 05/Jun/19 Updated: 26/Dec/22 Resolved: 14/Dec/22 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Nathan Brown (Inactive) | Assignee: | Alex Neben |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | neweng, post-v4-toolchain | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Assigned Teams: |
Server Development Platform
|
| Participants: |
| Description |
|
strtod requires a null terminated string, but std::from_chars does not. |
| Comments |
| Comment by Alex Neben [ 14/Dec/22 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Here is the diff that is missing the +/- sign as well as leading whitespace
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Alex Neben [ 14/Dec/22 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
From the docs this behaves differently than strtod. https://en.cppreference.com/w/cpp/utility/from_chars
+/- sign and leading whitespace make this a noticeable change. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Andrew Morrow (Inactive) [ 13/Jun/19 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Probably not worth it then since we aren't going to upgrade GCC or clang for some time. Lets stop working on it, move it to PM-1381, and set the fixVersion to backlog. We will try again when we have newer GCC and clang. Hopefully they have implemented it by then. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by A. Jesse Jiryu Davis [ 13/Jun/19 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
str::from_chars doesn't support doubles in GCC or Clang yet, only MSVC, so we can't replace strtod yet. We could use std::from_chars in place of our handwritten integer parsing code in parseNumberFromStringWithBase. acm does that seem worthwhile? |