Hello-
does anyone know why round() does not work correctly in a C program without using the compiler flag "-std=c99". any program will compile correctly without any warnings in gcc but then the function will return garbage data unless the flag is added during compilation. there's no mention of this in the man page... i only discovered this by googling and then finding this response "http://gcc.gnu.org/ml/gcc-bugs/2004-01/msg02169.html". is this a problem with the glibc package in Fedora? i feel this is either a bug or something that should be documented in a man page somewhere.. and yes, to mention the obvious, i did #include <math.h> in my source and also compiled in gcc with the -lm option. thanks everyone...
mark. :-)
__________________________________ Do you Yahoo!? Friends. Fun. Try the all-new Yahoo! Messenger. http://messenger.yahoo.com/
Mark Fonnemann wrote:
is this a problem with the glibc package in Fedora?
Did you ever consider that it's your fault? It is apparent that you did not since otherwise you'd have passed -Wall to gcc to first eliminate all your bugs (including this case you complain about).
i feel this is either a bug or something that should be documented in a man page somewhere..
It is documented in all the places. round() is a function introduced in C99 which means the prototype is not available by default. Therefore either pass -std=c99 or -D_ISOC99_SOURCE to the compiler.
I just hope that possible employers during their background checks stumble across this kind of messages to weed out incompetent programmers who always try to blame others for the bugs in their own code.
On May 29, 2004, Ulrich Drepper drepper@redhat.com wrote:
I just hope that possible employers during their background checks stumble across this kind of messages to weed out incompetent programmers who always try to blame others for the bugs in their own code.
Agreed. I also hope that possible employers during their background checks stumble across this kind of messages to weed out programmers that are compelled to make personal attacks. Individual and team morales, and respect for co-workers, are also important for productivity, you know... :-/
On Sat, May 29, 2004 at 07:27:57PM -0700, Mark Fonnemann wrote:
does anyone know why round() does not work correctly in a C program without
using the compiler flag "-std=c99". any program will compile correctly without
Because is a C99 fuynction
the glibc package in Fedora? i feel this is either a bug or something that should be documented in a man page somewhere.. and yes, to mention the obvious,
See the man page
"CONFORMING TO C99."
i did #include <math.h> in my source and also compiled in gcc with the -lm option. thanks everyone...
Did you compile with -Wall -pedantic however ? If you turned lots of warnings on you would have been warned about the lack of a prototype for round() and known you needed one so that it knew the return type was double.
Its marked "INVALID" in gcc bugs for good reasons.