This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: c/442


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]