Mail Archives: djgpp/2005/01/08/11:45:31.1
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f
|
From: | "Samuel Lauber" <sam124 AT operamail DOT com>
|
Newsgroups: | comp.os.msdos.djgpp
|
References: | <NsLDd.54447$nP1 DOT 27785 AT twister DOT socal DOT rr DOT com> <01c4f56a$Blat.v2.2.2$ecce5460 AT zahav DOT net DOT il>
|
Subject: | Re: Strange problems with printf()
|
Lines: | 22
|
X-Priority: | 3
|
X-MSMail-Priority: | Normal
|
X-Newsreader: | Microsoft Outlook Express 6.00.2800.1409
|
X-MIMEOLE: | Produced By Microsoft MimeOLE V6.00.2800.1409
|
Message-ID: | <6_TDd.54474$nP1.27946@twister.socal.rr.com>
|
Date: | Sat, 08 Jan 2005 16:36:18 GMT
|
NNTP-Posting-Host: | 204.210.96.202
|
X-Complaints-To: | abuse AT rr DOT com
|
X-Trace: | twister.socal.rr.com 1105202178 204.210.96.202 (Sat, 08 Jan 2005 08:36:18 PST)
|
NNTP-Posting-Date: | Sat, 08 Jan 2005 08:36:18 PST
|
Organization: | RoadRunner - West
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
>> 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 first floating point number I tried was 5.86, and I tried
it with smaller and smaller FP numbers, with /without
decimal points. Change it to 5.86 or even 1.1.
- Raw text -