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

proposal: add -Werror-implicit-function-declaration to the default optflags



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.

Regards,

Hans


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