The 'Effective C++' warnings in MinGW

478 Views Asked by At

MinGW has this option you can enable that shows warnings suggested by Scott Meyers' Effective C++. I don't have the book, nor can I easily get a copy of it, nor do I have the time now to read it, so my question is, what exactly are these "Meyers warnings"?

1

There are 1 best solutions below

0
On BEST ANSWER

http://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html

-Weffc++ (C++ and Objective-C++ only)

Warn about violations of the following style guidelines from Scott Meyers' Effective C++ book:

  • Item 11: Define a copy constructor and an assignment operator for classes with dynamically 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 Effective C++ book:

  • Item 6: Distinguish between prefix and postfix forms of increment and decrement operators.
  • 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.