public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/12437] New: scanf behavior differs from WG14/N1256 Committee Draft — Septermber 7, 2007
@ 2011-01-25 20:46 hjl.tools at gmail dot com
  2011-01-25 22:49 ` [Bug libc/12437] " drepper.fsp at gmail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: hjl.tools at gmail dot com @ 2011-01-25 20:46 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=12437

           Summary: scanf behavior differs from WG14/N1256 Committee Draft
                    — Septermber 7, 2007
           Product: glibc
           Version: 2.13
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper.fsp@gmail.com
        ReportedBy: hjl.tools@gmail.com


Page 300 in

http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf

says "100e" shouldn't match "%f". But I got

[hjl@gnu-6 tmp]$ cat s.c
#include <stdio.h>

int main()
{
  int count;
  float quant;
  char buf[100];
  count = fscanf(stdin, "%f%s", &quant, buf);
  printf ("quant = %lf\n",quant );
  printf ("count = %d\n", count);
  printf ("string = %s\n", buf);
  return 0;
}
[hjl@gnu-6 tmp]$ gcc s.c
[hjl@gnu-6 tmp]$ cat x.input 
100ergs of energy
[hjl@gnu-6 tmp]$ ./a.out  < x.input 
quant = 100.000000
count = 2
string = rgs
[hjl@gnu-6 tmp]$ 

I was told that Windows and MacOS behave the same as glibc.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-06-27 14:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-25 20:46 [Bug libc/12437] New: scanf behavior differs from WG14/N1256 Committee Draft — Septermber 7, 2007 hjl.tools at gmail dot com
2011-01-25 22:49 ` [Bug libc/12437] " drepper.fsp at gmail dot com
2011-10-07  4:24 ` bugdal at aerifal dot cx
2012-02-21  2:20 ` [Bug stdio/12437] " jsm28 at gcc dot gnu.org
2012-09-28  4:53 ` bugzilla-mail-box at yandex dot ru
2012-09-28 12:27 ` bugdal at aerifal dot cx
2014-06-27 14:00 ` fweimer at redhat dot com
2014-06-27 14:00 ` fweimer at redhat dot com

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).