www.delorie.com/djgpp/bugs/show.cgi   search  
Bug 000182

When Created: 10/23/1997 20:20:45
Against DJGPP version: 2.01
By whom: eldredge@ap.net
Abstract: scanf() with %LG specifier doesn't read a long double
When using the scanf() family with a %LG format specifier, a `double'
is read instead of a `long double' as the docs claim.
Note that this is apparently a DJGPP extension and not ANSI std.

Workaround added: 10/23/1997 20:22:34
By whom: eldredge@ap.net
Use `%Lg' or `%Le' (oh yeah, it also happens for `%LE') instead.

Solution added: 10/23/1997 20:39:07
By whom: eldredge@ap.net
Here is a patch which fixes it, for file ansi/stdio/doscan.c
*** src\libcnsi\stdio\~doscan.c
Sat May 18 21:40:02 1996
--- src\libcnsi\stdio\doscan.c        Thu Oct 23 17:22:24 1997
--- src\libcnsi\stdio\doscan.c
***************Thu Oct 23 17:22:24 1997
*** 100,104 *******************
        if (size==LONG)*** 100,104 ****
          size = LONGDOUBLE;        if (size==LONG)
!       else          size = LONGDOUBLE;
          size = LONG;!       else
          size = LONG;
      }

Solution added: 10/23/1997 20:43:39
By whom: eldredge@ap.net
Here is a patch which fixes it, for file ansi/stdio/doscan.c
*** src\libcnsi\stdio\~doscan.c
Sat May 18 21:40:02 1996
--- src\libcnsi\stdio\doscan.c
Thu Oct 23 17:22:24 1997
***************
*** 100,104 ****
        if (size==LONG)
          size = LONGDOUBLE;
!       else
          size = LONG;
      }
--- 100,104 ----
        if (size==LONG)
          size = LONGDOUBLE;
!       else if (size != LONGDOUBLE)
          size = LONG;
      }

Note added: 04/13/1999 12:00:33
By whom: eliz@is.elta.co.il
The bug was real, but %LG is NOT a DJGPP extension, contrary to what
Nate says: it's part of the ANSI C Standard.

Fixed in version on 04/13/1999 12:00:50
By whom: eliz@is.elta.co.il



  webmaster     delorie software   privacy  
  Copyright © 2010   by DJ Delorie     Updated Jul 2010