[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#243507: g++-3.3: broken fprintf output for floating-point formatted numbers



On Tue, Apr 13, 2004 at 18:15:25 +0400, Nikita V. Youshchenko wrote:
> It's a bug in the code, not in the compiler. Compiler can't do any
> type-checking for variable argument functions.
> 
> Well, gcc has some logic implemented specially for printf and company, 
> maybe it should be fixed.

When I add a line
	printf("%f\n", 0);
I do get a warning with -Wall:
	test.cc: In function `int main()':
	test.cc:6: warning: double format, different type arg (arg 2)

Similarly, /usr/include/stdio.h specifies __printf__ attributes [*] for
functions like snprintf, vsnprintf, vasprintf, asprintf, vdprintf and
dprintf. It does not do so for vfprintf. This looks like a bug in libc6-dev.

Ray

[*] See http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
-- 
UNFAIR  Term applied to advantages enjoyed by other people which we tried
to cheat them out of and didn't manage. See also DISHONESTY, SNEAKY,
UNDERHAND and JUST LUCKY I GUESS.
    - The Hipcrime Vocab by Chad C. Mulligan



Reply to: