This is the mail archive of the
mailing list for the libstdc++ project.
- To: cfox at crystalcherry dot com (Colin Fox)
- Subject: Re: -Weffc++
- From: Joe Buck <jbuck at synopsys dot COM>
- Date: Wed, 18 Jul 2001 13:16:07 -0700 (PDT)
- Cc: libstdc++ at gcc dot gnu dot org
> gcc has a great warning option: -Weffc++, which would be really nice to
> be able to use.
-Weffc++ has some warnings that are bogus, in that the only way to silence
them is to make your code worse (by, for example, adding a virtual
destructor that isn't needed to objects that would otherwise have only
one field, e.g. in the envelope and letter pattern, where you want to
write your reference counting code once and use private derivation to
get a specialized envelope and a specialized letter). This kind of thing
has a particular problem for the STL, since Effective C++ thinks that
everything should be virtual and STL has no virtual functions. -Weffc++
will probably ask for lots of virtual destructors in the STL, and that
would be wrong.
When first implemented, -Weffc++ it was put in -Wall. I insisted that it
be taken out again and was able to persuade the developers based on
arguments like the above.
> Unfortunately, when compiling with the standard libraries, we get a ton
> of warnings.
This does make the switch much less useful; it would be nice if the
warning could be suppressed in headers only.
> Are you guys interested in getting rid of these warnings? According to
> the Effective C++ book, a number of them could signify actual problems
> (at least as far as I understand).
It might be worth seeing if any of these warnings have any validity
(that is, whether the code in question could be improved).