PATCH RFA: Support -Wmissing-declarations in C++

Gabriel Dos Reis
Thu Dec 14 22:40:00 GMT 2006

On Thu, 14 Dec 2006, Ian Lance Taylor wrote:

| Gabriel Dos Reis <> writes:
| > |  It makes sense in the C++ world too, though I agree that
| > | it is not as important in C.  This option applies only to global
| > | functions, not to classes, nor to functions declared within classes
| > | (aka methods).
| >
| > and not to (implicit) specializations of templates, etc.
| >
| > Which makes it nearly pointless.
| Some people write C++ as a "better C".

C++ as a "better C" is one that is written idiomatically as C++.

| For those people, this option
| is useful.
| > Idiomatic C++ is based on the notion that you don't need to declare a
| > function before defining it -- and there are lot of functions you can't
| > declare that way.  What this option will do is replicate another
| > -Weffc++ fiasco.
| I disagree.  Nobody is going to accidentally turn on this option
| thinking that it is useful, unless they understand what it does.

I strongly disagree with that assertion.

Looking at the reports over the years, for example, people don't turn
-Weffc++ just by accident.  The premisse that people would turn on a
warning by accident is meaningless; equally meaningless is the
premisse nobdoy will turn on a warning by accident.

What you have to do is consider how warnings intereacts with idiomatic
C++.  Idiomatic C++, means that people use many third-party libraries,
and those libraries tend to have their implementations in headers.  A
situation that is very different from C.

| And,
| even if they do, it is unlikely to ever fire for them if they write
| your "idiomatic C++."

It is not "mine".  Please, do think through how C++ programs are
written these days.

-- Gaby

More information about the Gcc-patches mailing list