-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Add wcstod() and wcstof() functions #21193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Add wcstod() and wcstof() functions for wide-character string to double and float conversion.
|
If we do want to add these function I think its the musl here where they should live (system/lib/libc/musl/include/wchar.h). However it looks like the Do you know where the reference to |
|
Just passing by, but locale-aware |
Oh I see, these are GNU extensions, but they don't exist in musl. We could had them either directly to It looks like musl already implements some string functions that do take locale, so it should be easy enough to mimic those: emscripten/system/lib/libc/musl/include/wchar.h Lines 156 to 174 in 4aefde3
|
|
Yes, I didn't mean to imply they weren't vendor extensions. It seems like they'd be best placed in musl upstream, but small libc's never implement "proper" locale support due to the added code size/maintenance burden, and, well, they kinda have a point 🤷 As I understand it, implementing these as thin wrappers over their non- |
|
@SaraBaradaran could you update this PR to modify |
Sure! |
|
Currently, |
|
Ah, so perhaps the best place would be to put them in I'm a little confused how this works on glibc BTW, since glibc doesn't seem to have xlocale.h at all. |
Functions
wcstod(),wcstof(), andwcstold()convert a wide-character string into a double, float, and long double, respectively. Emscripten only supports wcstold() and I received the following errors when I compiled a code that calls two other functions:error: no member named 'wcstof_l' in the global namespace; did you mean 'wcstold_l'?error: no member named 'wcstod_l' in the global namespace; did you mean 'wcstold_l'?This pull request adds two functions
wcstod()andwcstof().