* strtof is missing @ 2002-11-23 16:03 jblazi 2002-11-24 5:23 ` Arseny Slobodjuck 0 siblings, 1 reply; 13+ messages in thread From: jblazi @ 2002-11-23 16:03 UTC (permalink / raw) To: cygwin I use a pretty new Cygwin release and I notice that the strtof function is missing in stdlib.h. On my Linux system the function is declared in stdlib.h. Can anybody help me? I should have to convert a string to a flat and this seems to be the only possibility. (O do not want to have double). TIA, -- Janos Blazi -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: strtof is missing 2002-11-23 16:03 strtof is missing jblazi @ 2002-11-24 5:23 ` Arseny Slobodjuck 2002-11-24 5:25 ` Corinna Vinschen 0 siblings, 1 reply; 13+ messages in thread From: Arseny Slobodjuck @ 2002-11-24 5:23 UTC (permalink / raw) To: jblazi; +Cc: cygwin Hi, 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. -- Best regards, Arseny mailto:ampy@vtc.ru -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: strtof is missing 2002-11-24 5:23 ` Arseny Slobodjuck @ 2002-11-24 5:25 ` Corinna Vinschen 2002-11-24 8:16 ` Janos Blazi 2002-12-04 11:58 ` J. Johnston 0 siblings, 2 replies; 13+ messages in thread From: Corinna Vinschen @ 2002-11-24 5:25 UTC (permalink / raw) To: newlib; +Cc: cygwin 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?!? Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Developer mailto:cygwin@cygwin.com Red Hat, Inc. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: strtof is missing 2002-11-24 5:25 ` Corinna Vinschen @ 2002-11-24 8:16 ` Janos Blazi 2002-12-04 11:58 ` J. Johnston 1 sibling, 0 replies; 13+ messages in thread From: Janos Blazi @ 2002-11-24 8:16 UTC (permalink / raw) To: cygwin > However, I just had a look into newlib and there's a function > > float strtodf (const char *, char **); > > defined. Thx, I saw that too. There were sevaral ways to work around this "problem" but I when I came across it, I simply wanted to report it. JB -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: strtof is missing 2002-11-24 5:25 ` Corinna Vinschen 2002-11-24 8:16 ` Janos Blazi @ 2002-12-04 11:58 ` J. Johnston 2002-12-05 1:37 ` Corinna Vinschen 1 sibling, 1 reply; 13+ messages in thread From: J. Johnston @ 2002-12-04 11:58 UTC (permalink / raw) To: Corinna Vinschen; +Cc: newlib [-- Attachment #1: Type: text/plain, Size: 1391 bytes --] 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 > [-- Attachment #2: strtof.patch --] [-- Type: text/plain, Size: 2400 bytes --] Index: libc/include/stdlib.h =================================================================== RCS file: /cvs/src/src/newlib/libc/include/stdlib.h,v retrieving revision 1.19 diff -u -r1.19 stdlib.h --- libc/include/stdlib.h 26 Aug 2002 04:33:46 -0000 1.19 +++ libc/include/stdlib.h 4 Dec 2002 19:36:20 -0000 @@ -93,8 +93,9 @@ _VOID _EXFUN(srand,(unsigned __seed)); double _EXFUN(strtod,(const char *__n, char **__end_PTR)); double _EXFUN(_strtod_r,(struct _reent *,const char *__n, char **__end_PTR)); +float _EXFUN(strtof,(const char *__n, char **__end_PTR)); #ifndef __STRICT_ANSI__ -float _EXFUN(strtodf,(const char *__n, char **__end_PTR)); +#define strtodf strtof #endif long _EXFUN(strtol,(const char *__n, char **__end_PTR, int __base)); long _EXFUN(_strtol_r,(struct _reent *,const char *__n, char **__end_PTR, int __base)); Index: libc/stdlib/strtod.c =================================================================== RCS file: /cvs/src/src/newlib/libc/stdlib/strtod.c,v retrieving revision 1.3 diff -u -r1.3 strtod.c --- libc/stdlib/strtod.c 20 Apr 2001 22:50:51 -0000 1.3 +++ libc/stdlib/strtod.c 4 Dec 2002 19:36:20 -0000 @@ -12,7 +12,7 @@ ANSI_SYNOPSIS #include <stdlib.h> double strtod(const char *<[str]>, char **<[tail]>); - float strtodf(const char *<[str]>, char **<[tail]>); + float strtof(const char *<[str]>, char **<[tail]>); double _strtod_r(void *<[reent]>, const char *<[str]>, char **<[tail]>); @@ -23,7 +23,7 @@ char *<[str]>; char **<[tail]>; - float strtodf(<[str]>,<[tail]>) + float strtof(<[str]>,<[tail]>) char *<[str]>; char **<[tail]>; @@ -48,7 +48,7 @@ (which will contain at least the terminating null character of <[str]>) is stored in <<*<[tail]>>>. If you want no assignment to <<*<[tail]>>>, pass a null pointer as <[tail]>. - <<strtodf>> is identical to <<strtod>> except for its return type. + <<strtof>> is identical to <<strtod>> except for its return type. This implementation returns the nearest machine number to the input decimal string. Ties are broken by using the IEEE @@ -721,11 +721,11 @@ } float -_DEFUN (strtodf, (s00, se), +_DEFUN (strtof, (s00, se), _CONST char *s00 _AND char **se) { - return _strtod_r (_REENT, s00, se); + return (float)_strtod_r (_REENT, s00, se); } #endif [-- Attachment #3: Type: text/plain, Size: 214 bytes --] -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: strtof is missing 2002-12-04 11:58 ` J. Johnston @ 2002-12-05 1:37 ` Corinna Vinschen 2002-12-05 1:44 ` Robert Collins 0 siblings, 1 reply; 13+ messages in thread From: Corinna Vinschen @ 2002-12-05 1:37 UTC (permalink / raw) To: cygwin; +Cc: newlib On Wed, Dec 04, 2002 at 02:47:36PM -0500, J. Johnston wrote: > 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. Thanks Jeff, but I guess it's better to keep the strtodf() function for backward compatibility. I would suggest just to add another function strtof() so that old applications (linked e.g. against old versions of Cygwin) will keep running under newer versions. Removing the symbol might break these applications (though I assume there aren't that much apps using strtodf). Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Developer mailto:cygwin@cygwin.com Red Hat, Inc. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: strtof is missing 2002-12-05 1:37 ` Corinna Vinschen @ 2002-12-05 1:44 ` Robert Collins 2002-12-05 7:08 ` Christopher Faylor 0 siblings, 1 reply; 13+ messages in thread From: Robert Collins @ 2002-12-05 1:44 UTC (permalink / raw) To: cygwin; +Cc: newlib [-- Attachment #1: Type: text/plain, Size: 414 bytes --] On Thu, 2002-12-05 at 20:34, Corinna Vinschen wrote: > Removing the symbol might > break these applications (though I assume there aren't that much apps > using strtodf). We can just export it twice from cygwin.din. That + Jeff's patch will keep backwards compatability and provide the right API for new apps. Rob -- --- GPG key available at: http://users.bigpond.net.au/robertc/keys.txt. --- [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: strtof is missing 2002-12-05 1:44 ` Robert Collins @ 2002-12-05 7:08 ` Christopher Faylor 2002-12-05 12:24 ` J. Johnston 0 siblings, 1 reply; 13+ messages in thread From: Christopher Faylor @ 2002-12-05 7:08 UTC (permalink / raw) To: cygwin, newlib On Thu, Dec 05, 2002 at 08:37:22PM +1100, Robert Collins wrote: >On Thu, 2002-12-05 at 20:34, Corinna Vinschen wrote: >>Removing the symbol might break these applications (though I assume >>there aren't that much apps using strtodf). > >We can just export it twice from cygwin.din. That + Jeff's patch will >keep backwards compatability and provide the right API for new apps. Yes, I think this is the best approach. cgf -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: strtof is missing 2002-12-05 7:08 ` Christopher Faylor @ 2002-12-05 12:24 ` J. Johnston 2002-12-05 14:34 ` Christopher Faylor 0 siblings, 1 reply; 13+ messages in thread From: J. Johnston @ 2002-12-05 12:24 UTC (permalink / raw) To: cygwin Chris, Can you clarify. Do you want me to duplicate the routine or stick with the solution I originally presented which is to rename the routine and leave a #define that maps the old name to the new one. -- Jeff J. Christopher Faylor wrote: > On Thu, Dec 05, 2002 at 08:37:22PM +1100, Robert Collins wrote: > >>On Thu, 2002-12-05 at 20:34, Corinna Vinschen wrote: >> >>>Removing the symbol might break these applications (though I assume >>>there aren't that much apps using strtodf). >> >>We can just export it twice from cygwin.din. That + Jeff's patch will >>keep backwards compatability and provide the right API for new apps. > > > Yes, I think this is the best approach. > > cgf -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: strtof is missing 2002-12-05 12:24 ` J. Johnston @ 2002-12-05 14:34 ` Christopher Faylor 0 siblings, 0 replies; 13+ messages in thread From: Christopher Faylor @ 2002-12-05 14:34 UTC (permalink / raw) To: cygwin; +Cc: jjohnstn On Thu, Dec 05, 2002 at 02:54:08PM -0500, J. Johnston wrote: >Chris, > > Can you clarify. Do you want me to duplicate the routine or >stick with the solution I originally presented which is to rename >the routine and leave a #define that maps the old name to the >new one. I think your plan is fine. I think just renaming the function in newlib and creating a define to deal with legacy newlib apps is the correct way to handle this. We can also make modifications in the cygwin side to make it transparent to the end user. cgf -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ ^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: strtof is missing
@ 2002-12-05 7:32 Rolf Campbell
0 siblings, 0 replies; 13+ messages in thread
From: Rolf Campbell @ 2002-12-05 7:32 UTC (permalink / raw)
To: cygwin; +Cc: newlib
> -----Original Message-----
> From: Robert Collins [mailto:rbcollins@cygwin.com]
> Sent: Thursday, December 05, 2002 4:37 AM
> To: cygwin@cygwin.com
> Cc: newlib@sources.redhat.com
> Subject: Re: strtof is missing
>
>
> On Thu, 2002-12-05 at 20:34, Corinna Vinschen wrote:
>
> > Removing the symbol might
> > break these applications (though I assume there aren't that
> much apps
> > using strtodf).
>
> We can just export it twice from cygwin.din. That + Jeff's
> patch will keep backwards compatability and provide the right
> API for new apps.
How about a deprecated inline function instead of a define? That way,
at least people will get warnings if they try to use the old function.
-Rolf
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: strtof is missing
@ 2002-12-05 14:57 Rolf Campbell
2002-12-05 17:17 ` Christopher Faylor
0 siblings, 1 reply; 13+ messages in thread
From: Rolf Campbell @ 2002-12-05 14:57 UTC (permalink / raw)
To: cygwin; +Cc: jjohnstn
Wouldn't it be more helpful to point out that the function is
deprecated?
-Rolf
> -----Original Message-----
> From: Christopher Faylor [mailto:cgf@redhat.com]
> Sent: Thursday, December 05, 2002 5:21 PM
> To: cygwin@cygwin.com
> Cc: jjohnstn@redhat.com
> Subject: Re: strtof is missing
>
>
> On Thu, Dec 05, 2002 at 02:54:08PM -0500, J. Johnston wrote:
> >Chris,
> >
> > Can you clarify. Do you want me to duplicate the routine or stick
> >with the solution I originally presented which is to rename
> the routine
> >and leave a #define that maps the old name to the new one.
>
> I think your plan is fine. I think just renaming the
> function in newlib and creating a define to deal with legacy
> newlib apps is the correct way to handle this. We can also
> make modifications in the cygwin side to make it transparent
> to the end user.
>
> cgf
>
> --
> Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting: http://cygwin.com/bugs.html
> Documentation: http://cygwin.com/docs.html
> FAQ: http://cygwin.com/faq/
>
>
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: strtof is missing 2002-12-05 14:57 Rolf Campbell @ 2002-12-05 17:17 ` Christopher Faylor 0 siblings, 0 replies; 13+ messages in thread From: Christopher Faylor @ 2002-12-05 17:17 UTC (permalink / raw) To: cygwin On Thu, Dec 05, 2002 at 05:34:46PM -0500, Rolf Campbell wrote: >Wouldn't it be more helpful to point out that the function is >deprecated? That's Jeff's call. I don't care. We still have to do cygwin def file magic one way or the other so there could still conceivably be applications using strtodf for years to come. cgf -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2002-12-06 1:14 UTC | newest] Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2002-11-23 16:03 strtof is missing jblazi 2002-11-24 5:23 ` Arseny Slobodjuck 2002-11-24 5:25 ` Corinna Vinschen 2002-11-24 8:16 ` Janos Blazi 2002-12-04 11:58 ` J. Johnston 2002-12-05 1:37 ` Corinna Vinschen 2002-12-05 1:44 ` Robert Collins 2002-12-05 7:08 ` Christopher Faylor 2002-12-05 12:24 ` J. Johnston 2002-12-05 14:34 ` Christopher Faylor 2002-12-05 7:32 Rolf Campbell 2002-12-05 14:57 Rolf Campbell 2002-12-05 17:17 ` Christopher Faylor
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).