Hello,
I notice that when pass a non-numeric char to strtod, musl will set errno to non-zero, but glibc will set errno to zero.
I am curious why this difference exists, and whether it is necessary to make strtod in musl behave similarly to glibc.
Here is the toy program:
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv) {
errno = 0;
char input[] = "NA023";
strtod(input, NULL);
printf("errno = %d\n", errno);
perror("strtod");
return 0;
}
Output (musl):
bash-4.3# ./main
errno = 22
strtod: Invalid argument
Output (glibc, Ubuntu 16.04):
> ./main
errno = 0
strtod: Success
Best,
Xiaowei