Is there a FLAG setting in makefile to detect duplicate function declarations?
Duplicate function declarations in a header file are found, but compiler doesn't report it even FLAG is set as "warning as error".
Does this bring any implicit problem?
You're trying to solve a problem that doesn't exist. There is generally no problem with duplicated function declarations, so there is no reason for a compiler to diagnose them.
A C compiler will typically diagnose situations, in the same compilation unit, where a function is declared in more than one way (e.g. two declarations of the same function with different return type or argument types).
Duplicate function definitions (a particular type of function declaration - which implements the function) are a problem. Practically, a compiler will give warnings or errors when multiple definitions of a function occur in a compilation unit. A linker will also report cases where a function is defined in more than one compilation unit - the exceptions being functions that are either inline or static (local to its compilation unit).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With