SLUG Mailing List Archives
Re: [SLUG] -Wshadow
- To: slug@xxxxxxxxxxx
- Subject: Re: [SLUG] -Wshadow
- From: Matthew Hannigan <mlh@xxxxxxxxxx>
- Date: Wed, 25 May 2005 10:42:21 +1000
- User-agent: Mutt/1.3.28i
On Wed, May 25, 2005 at 10:03:08AM +1000, John Clarke wrote:
> and for C++ I use:
> -Wall -W -Wpointer-arith -Wfloat-equal -Wcast-align -Wcast-qual
> -Waggregate-return -Wno-unused-parameter -Wreorder
> -Wctor-dtor-privacy -Wnon-virtual-dtor -Wno-non-template-friend
I don't do much C++ but -Weffc++ looks pretty cool.
-Weffc++ (C++ only)
Warn about violations of the following style guidelines from Scott Meyers' Effective C++
* Item 11: Define a copy constructor and an assignment operator for classes with dynami-
cally allocated memory.
* Item 12: Prefer initialization to assignment in constructors.
* Item 14: Make destructors virtual in base classes.
* Item 15: Have "operator=" return a reference to *this.
* Item 23: Don't try to return a reference when you must return an object.
Also warn about violations of the following style guidelines from Scott Meyers' More Effec-
tive C++ book:
* Item 6: Distinguish between prefix and postfix forms of increment and decrement opera-
* Item 7: Never overload "&&", "||", or ",".
When selecting this option, be aware that the standard library headers do not obey all of
these guidelines; use grep -v to filter out those warnings.