lists.zerezo.com



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

***BOGO*** [Mingw-users] strtod is not C99-compatible



Hello,

According to [0], strtod() should be able to parse hexadecimal numbers. 
But in Windows[1], it doesn't.

This simple test program:
#include <stdlib.h>
#include <stdio.h>

int main()
{
     const char *string = "0x00800000";
     char *end;
     double value;

     value = strtod(string, &end);

     printf("string \"%s\"\n", string);
     printf("end \"%s\"\n", end);
     printf("value %f\n", value);

     return 0;
}

should print:
string "0x00800000"
end ""
value 8388608.000000

but instead it prints:
string "0x00800000"
end "x00800000"
value 0.000000

Is it possible that a function to replace strtod() with a C99-compliant 
implementation be made the same way it was done with snprintf? And then 
one would have to call _strtod to get the original MSVCRT version.

Ramiro Polla
[0] http://www.opengroup.org/onlinepubs/000095399/functions/strtod.html
[1] http://msdn.microsoft.com/en-us/library/kxsfc1ab(vs.71).aspx

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users