This is the mail archive of the
mailing list for the GCC project.
Re: Warning on C++ catch by value on non primitive types
- From: Joe Buck <Joe dot Buck at synopsys dot COM>
- To: Benjamin Kosnik <bkoz at redhat dot com>
- Cc: gcc at gcc dot gnu dot org, tcosta at ovro dot caltech dot edu
- Date: Thu, 13 Oct 2005 08:58:57 -0700
- Subject: Re: Warning on C++ catch by value on non primitive types
- References: <email@example.com>
On Thu, Oct 13, 2005 at 09:41:22AM -0500, Benjamin Kosnik wrote:
> > yeah, if it were in one of those books it could be added to the -weff-c+
> > + option. It doesn't seem sensible to add a different option for an
> > alternative (set of?) coding rule(s).
> FYI this is item 13 in MEC++.
-Weffc++ is broken and should just die. The coding rules they propose,
and that the flag enforces, are completely incompatible with the STL: you
cannot write a C++ standard library in a way that doesn't either spew tons
of -Weffc++ warnings or that bloats out most of the objects by adding an
unnecessary virtual function table to all kinds of objects that are now a
single pointer (you're pretty much forced to put a virtual destructor in
any class that is inherited from). That's two pointers instead of one
in most iterators and function objects.
Yes, you can tell the compiler to ignore warnings in system headers,
but then users can't use the same programming techniques that are used
in the STL.
So please don't build anything new on top of this ill-considered warning.