On Fri, Aug 19, 2011 at 11:17 PM, Ian Lance Taylor <i...@google.com> wrote: > Gabriel Dos Reis <g...@integrable-solutions.net> writes: > >> what would it do? There is no notion of `prototype' in C++ (as C >> programmers understand it). >> So, what would it mean to warn about something we can't take the >> negation of? ;-) > > -Wmissing-prototypes means that if the compiler sees a globally visible > function definition, it warns if no previous definition of the function > was seen. This is a way of ensuring that the file which defines a > function #includes the header file which declares the function, thus > ensuring that the definition matches the declaration. Although the name > is wrong for C++, the option is meaningful for C++ just as it is for C.
So that is -Wmissing-declaration if I understand correctly? By "globally visible function definition" do you also include member functions? That would be unusual. I am also concerned that it would mean that a non-member inline function would have to be declared first, as that is not the case for colloquial C++. I understand what the `prototype' notion is immensely useful in C. But the problem it was designed to help mitigate has been cured long in C++, and I worry that trying to placate that to modern C++ would lead to non-colloquial C++. > > (I actually sent a patch implementing this option to RMS back when I was > first starting to work with gcc, although I think he rewrote it.) > > Ian >