X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f Date: Sat, 08 Jan 2005 12:14:03 +0200 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: djgpp AT delorie DOT com Message-ID: <01c4f56a$Blat.v2.2.2$ecce5460@zahav.net.il> Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=ISO-8859-1 X-Mailer: emacs 21.3.50 (via feedmail 8 I) and Blat ver 2.2.2 In-reply-to: (sam124 AT operamail DOT com) Subject: Re: Strange problems with printf() References: Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > From: "Samuel Lauber" > Date: Sat, 08 Jan 2005 06:54:37 GMT > > int printf(char *, ...); > int main(void) > { > printf("%f\n", 1); > } > > Compile it, and it would say `Unnormal'. Is this a bug? A bug, yes, but in your program, not in the compiler or the library. If you compile with the -Wall switch, which prints warnings for dubious code, the compiler says: cfp.c: In function `main': cfp.c:4: warning: double format, different type arg (arg 2) cfp.c:5: warning: control reaches end of non-void function The first warning is directly related to what you see: you should use printf("%f\n", 1.0); i.e. make the argument be a float or a double, not an int. The second warning says that you should end this program with return 0; since `main' is declared a function that returns an int.