delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/10/29/11:24:21

From: khan AT xraylith DOT wisc DOT edu (Mumit Khan)
Subject: Re: B19: gcc/libc bug with call to atof() (Win95)
29 Oct 1998 11:24:21 -0800 :
Message-ID: <Pine.SUN.3.93.981028104729.28511A-100000.cygnus.gnu-win32@modi.xraylith.wisc.edu>
References: <3635B86F DOT 93BBC51A AT widex DOT com>
Reply-To: Mumit Khan <khan AT xraylith DOT wisc DOT edu>
Mime-Version: 1.0
To: Martin Hansen <m DOT hansen AT widex DOT com>
Cc: gnu-win32 AT cygnus DOT com

On Tue, 27 Oct 1998, Martin Hansen wrote:

> The following small program produces the bug:

[ ... ]

> The program compiles and I don't get any error about the missing line
> "#include <stdlib.h>", where atoi() and atof() are declared.  (This is
> the bug, part1)

Sorry, but your code is buggy. You *must* prototype atof before using 
it, otherwise the default return type in C is "int" and obviously you 
get garbage in this case. Either include <stdlib.h> or declare it 
yourself.

  $ gcc -c -Wall file.c

is a good check before blaming the compiler ...

Also, you probably should upgrade your compiler tools to egcs. See
Cygnus home page for link back to mine.

Regards,
Mumit


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

- Raw text -


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