strtof is missing

J. Johnston
Wed Dec 4 11:58:00 GMT 2002

Corinna Vinschen wrote:
> On Sun, Nov 24, 2002 at 10:34:37AM +1000, Arseny Slobodjuck wrote:
>>Sunday, November 24, 2002, 9:04:04 AM, you wrote:
>>j> I use a pretty new Cygwin release and I notice that the strtof function is 
>>j> missing in stdlib.h. On my Linux system the function is declared in stdlib.h.
>>j> Can anybody help me? I should have to convert a string to a flat and this 
>>j> seems to be the only possibility. (O do not want to have double).
>>How about atof or sscanf ? That is two.
> Or float f = (float) strtod ();
> However, I just had a look into newlib and there's a function
>     float strtodf (const char *, char **);
> defined.  There's no man page on Linux and no such entry in SUSv3, but
> it's the correct definition for strtof(3).  
> It looks like a typo, including stdlib.h.  Or is there a good reason
> for that definition?!?

It is not a typo.  Newlib was created to be ANSI with some Unix extensions.
Originally, strtodf was added in 1992 as an extension.  Since then, C99
has defined strtof.

Now, that said, since there is a strtof() routine defined in C99, we might
as well rename the extension.

The following is a patch which renames strtodf to be strtof and leaves a
#define mapping in stdlib for anybody using the old name.  Eventually, we should
be able to remove the old name entirely.

-- Jeff J.

> Corinna

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: strtof.patch
URL: <>
-------------- next part --------------
Unsubscribe info:
Bug reporting:

More information about the Cygwin mailing list