On 24/03/2008, Hans de Goede <j.w.r.degoede(a)hhs.nl> wrote:
Hi all,
This is a new thread spawning from the "3.6% of heads up: Please correct your
#includes or optflags use" thread.
I would like to propose to add "-Werror-implicit-function-declaration" to the
default optflags. Why? Because missing prototypes can cause all sorts of problems:
Anything (any function) that returns a pointer, will be a problem when compiled
on 64 bit without a prototype, as the compiler will assume the return type is
an int, and then cast that to a pointer as needed.
Anything returning a float / double will be a problem regardless of 32/64 bits
as only 32 bits of the returned floating point number will be taken and
interpreted as an int (and then cast back to a float / double if used as such).
Any function called with arguments of different type then expected (for example
a float, where the function expects an int or visa versa) will have the same
problem.
Which is why I say: fix them all.
+1
I was part of that 3.6% and found the fixes trivial. I'm all for code
hardening/improvement and haven't seen anyone able to give a good
reason against adding this in the other thread. This appears to be the
fairly low-hanging fruit we should take advantage of.
Cheers
--
Christopher Brown
http://www.chruz.com