This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/16166] -Weffc++ finer granularity
- From: "david at doublewise dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 29 May 2012 02:13:53 +0000
- Subject: [Bug c++/16166] -Weffc++ finer granularity
- Auto-submitted: auto-generated
- References: <bug-16166-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16166
--- Comment #4 from David Stone <david at doublewise dot net> 2012-05-29 02:13:53 UTC ---
I would recommend against naming each warning -Weffc++[n], but rather, give a
more descriptive name. My suggestion is to create a few warnings, so that
-Weffc++ would map to the following set of warnings (with their current
description for reference and my suggested name):
Effective C++:
* Item 11: Define a copy constructor and an assignment operator for classes
with dynamically allocated memory.
-Wcopy-resource-class
* Item 12: Prefer initialization to assignment in constructors.
-Wassignment-in-constructor
* Item 14: Make destructors virtual in base classes.
Already covered by -Wnon-virtual-dtor
* Item 15: Have operator= return a reference to *this.
-Wassignment-operator-return-value
* Item 23: Don't try to return a reference when you must return an object.
-Wsuspicious-reference-return
More Effective C++:
* Item 6: Distinguish between prefix and postfix forms of increment and
decrement operators.
-Wprefix-postfix
* Item 7: Never overload &&, ||, or ,.
Perhaps this should be split into two warnings of its own:
-Woverloaded-short-circuit
-Woverloaded-comma
In summary, you could simulate exactly the behavior of -Weffc++ by turning on
each of these warnings individually, or you could turn on -Weffc++ and
selectively turn off a few warnings that you don't want.