BUG: strtod() completely fails under cygwin-b20

Mumit Khan khan@xraylith.wisc.edu
Sun Jan 31 23:52:00 GMT 1999


Dobes Vandermeer <dobes@mindless.com> writes:
> 
> Here is my program:
> 
> int main()
> {
>   double val = strtod("3.123", 0);
>   printf("TEST: %g %g\n", 3.123, val);
>   return 0;
> }

Basic rule of C/C++ programming -- include the appropriate header so that
the prototypes are available. In your case, including stdlib.h should fix
it.

  #include <stdlib.h>
  #include <stdio.h>

  int main()
  {
    double val = strtod("3.123", 0);
    printf("TEST: %g %g\n", 3.123, val);
    return 0;
  }

> The results I WANTED would have 3.123 both times, and this is the
> behavior documented.
> 
> This same behavior is exhibited by atof()... This is a bug, I think.

Yes, it's a bug in your code.

You should *really* pay more attention to the compiler when it complains
about not finding the prototypes for strtod, printf etc; that should've
given you a clue as to what is wrong.

Regards,
Mumit

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".



More information about the Cygwin mailing list