This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: c/442
- To: nobody at gcc dot gnu dot org
- Subject: Re: c/442
- From: jsm28 at gcc dot gnu dot org
- Date: 7 Aug 2000 17:26:01 -0000
- Cc: gcc-prs at gcc dot gnu dot org,
- Reply-To: jsm28 at gcc dot gnu dot org
The following reply was made to PR c/442; it has been noted by GNATS.
From: jsm28@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org, jsm28@cam.ac.uk, lrwayne@earthlink.net,
nobody@gcc.gnu.org
Cc:
Subject: Re: c/442
Date: 7 Aug 2000 17:25:05 -0000
Synopsis: atof can give incorrect output
State-Changed-From-To: open->closed
State-Changed-By: jsm28
State-Changed-When: Mon Aug 7 10:25:05 2000
State-Changed-Why:
This is not a bug. Because no declaration of atof() is in scope, it
is implicitly declared to return int, which is wrong, so undefined
behavior results as you observed.
If you compile with -Wall, the warnings will show you the problem:
t.c: In function `main':
t.c:2: warning: implicit declaration of function `printf'
t.c:2: warning: implicit declaration of function `atof'
t.c:2: warning: double format, different type arg (arg 2)
t.c:3: warning: control reaches end of non-void function
(Compiling with -std=c99 -pedantic-errors in current GCC CVS will also
give an error for this code.)
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=442&database=gcc