Subject: Re: BUG: strtod() completely fails under cygwin-b20
From: [email-masked] (Mumit Khan)

3 Jan 1999 17:40:46 -0800
Message-ID: <[email-masked]>
References: <[email-masked]>
To: Dobes Vandermeer <[email-masked]>
Cc: [email-masked]

Dobes Vandermeer <[email-masked]> 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
"[email-masked]" with one line of text: "help".