Subject: [Fwd: Possible sscanf %f conversion glitch]
From: Corinna Vinschen <[email-masked]>
To: [email-masked]
Cc: [email-masked]
Date: Wed, 28 Jan 2009 18:24:22 +0100
List-Id: <cygwin.cygwin.com>

I'm forwarding this problem to the newlib list.  I checked against
the latest Cygwin from CVS and the problem still exists, afaics.

----- Forwarded message from KHMan -----
> Date: Wed, 28 Jan 2009 23:19:07 +0800
> From: KHMan
> Subject: Possible sscanf %f conversion glitch
> To: [email-masked]
> 
> Hi all,
>
> Someone ran into a problem with sscanf %f conversion on the Lout list. It 
> appeared that one specific case fails. I am running cygwin-1.5.25-15. Test 
> cases:
>
> #include <stdio.h>
> int main()
> {
>     char *foo1 = "10i";
>     char *foo2 = "0i";
>     char *foo3 = "0.0i";
>     char *foo4 = "1.0i";
>     char *foo5 = "0.1i";
>     float f;
>     printf("%d ", sscanf(foo1, "%f", &f)); printf("%f\n", f);
>     printf("%d ", sscanf(foo2, "%f", &f)); printf("%f\n", f);
>     printf("%d ", sscanf(foo3, "%f", &f)); printf("%f\n", f);
>     printf("%d ", sscanf(foo4, "%f", &f)); printf("%f\n", f);
>     printf("%d ", sscanf(foo5, "%f", &f)); printf("%f\n", f);
> }
>
> As the scanf man page specifies, 'i' is not supposed to be converted, only 
> the number part is supposed to be recognized.
>
> On Cygwin:
> $ ./test
> 1 10.000000
> 0 10.000000
> 1 0.000000
> 1 1.000000
> 1 0.100000
>
> On Linux (Ubuntu 8.04) and MinGW, the second case succeeds, the result 
> being the same as the third case. I've done some googling, and haven't 
> found anything related to this behaviour.
>
> -- 
> Cheers,
> Kein-Hong Man (esq.)
> Kuala Lumpur, Malaysia
----- End forwarded message -----

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/