This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]