This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH RFA: Support -Wmissing-declarations in C++
- From: Gabriel Dos Reis <gdr at cs dot tamu dot edu>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: 14 Dec 2006 14:12:23 -0600
- Subject: Re: PATCH RFA: Support -Wmissing-declarations in C++
- References: <m37iwujrjk.fsf@localhost.localdomain>
Ian Lance Taylor <iant@google.com> writes:
| Currently -Wmissing-declarations only works for C. But it makes just
| as much sense for C++ as it does for C. This patch adds support for
| -Wmissing-declarations in C++.
I don't think it makes that much sense for C++, let alone as much sense.
In C++, if you don't have a declaration in scope, it is a hard error.
In C, the situation is different, which led to -Wmissing-declarations.
-Wmissing-declarations embodies C ways of viewing and programming,
that are counter-idiomatic in C++.
Furthermore, a function can be declared only once at class scope. The
artificial dissymmetry that this switch will introduce for such a
fundamental notion as class in C++ is a strong hint that this switch
is best left for the C front-end.
-- Gaby