[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
weird printf() behavior
From: |
Kai-Min Sung |
Subject: |
weird printf() behavior |
Date: |
Tue, 5 Aug 2003 17:13:56 -0700 (PDT) |
Hi,
I'm not sure if this is a valid bug or just a known quirk, but I
wrote the following test code and saw some rather strange output:
-- begin foo.c --
#include <stdio.h>
int main()
{
float f = 1.1;
printf("%x, %f\n", f, f);
return 0;
}
-- end foo.c --
This output I see when I compile and run this is:
lever:~/tmp>./foo
a0000000, -0.000000
Somehow printing out the first hex argument clobbers the formatting of the
second floating-point argument. Can someone explain to me what's going on
here?
I'm testing this on a Redhat box using libc-2.2.5.
Thanks,
Kai-Min Sung
- weird printf() behavior,
Kai-Min Sung <=