Description of problem: There is an example in the C89 standard in the "4.9.6.2 The fscanf function" section, which describes, that %f specifier cannot read "100e", because there is no exponent part after "e" Version-Release number of selected component (if applicable): gcc 4.5.1 How reproducible: #include <stdio.h> int main(void) { int n; float f; char c = 'x'; n = scanf("%f%c", &f, &c); printf("%d %f %d\n", n, f, c); return 0; } Actual results: [guest@localhost std]$ .ansi t.c -o t [guest@localhost std]$ ./t 100e 2 100.000000 10 [guest@localhost std]$ alias .ansi alias .ansi='gcc -ansi -pedantic -Wall' [guest@localhost std]$ Expected results: from the standard '/* "100e" fails to match "%f" */' so scanf() should return EOF Additional info: C99 and C11 standards contain the same example
-so scanf() should return EOF +so scanf() should return 0
This is a known problem with glibc's scanf implementation. It is being tracked as bug #12437 in the glibc bug database (see External Trackers for a link). If/when this bug is fixed upstream, we'll pick it up via our usual procedures to resync with the upstream sources. Thanks, Jeff